From dcac0f1d43bf3d69cb07ebb1ca9dcc51f0c63742 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 4 Dec 2022 11:50:08 +0000 Subject: [PATCH] GTK: fix crash changing font size when terminal maximised. When I maximised a terminal window today and then used Ctrl-< to reduce its font size (expecting that the window size would stay the same but more characters would be squeezed in), pterm failed the assertion in term_request_resize_completed() that checks term->win_resize_pending == WIN_RESIZE_AWAIT_REPLY. This happened because in this situation request_resize_internal() was called from within window.c rather than from within the terminal code itself. So the terminal didn't know a resize is pending at all, and was surprised to be told that one had finished. request_resize_internal() already has a flag parameter to tell it whether a given resize came from the terminal or not. On the main code path, that flag is used to decide whether to notify the terminal. But on the early exit path when the window is maximised, we weren't checking the flag. An easy fix. (cherry picked from commit 95b926865a065e02b294b40ab899c8e921d87227) --- unix/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unix/window.c b/unix/window.c index 934311f2..1ca52833 100644 --- a/unix/window.c +++ b/unix/window.c @@ -2602,7 +2602,8 @@ static void request_resize_internal(GtkFrontend *inst, bool from_terminal, #endif 0)) { queue_toplevel_callback(gtkwin_deny_term_resize, inst); - term_resize_request_completed(inst->term); + if (from_terminal) + term_resize_request_completed(inst->term); return; } }