From e1323655ee2924cab5efd48fdb307e76b7d16b24 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Fri, 1 Apr 2022 10:40:53 +0300 Subject: [PATCH] Fix race condition on resize The current code is inherently racy: if screen update takes considerable time (e.g. when working over network) and a user performed a series of resizes the final event might get ignored and the display will be left in inconsistent state. Fix the race by unsetting the flag first so if the next WINCH signal is received while display is resizing it'll be processed on the next iteration. --- src/ui/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index 3b10888b..5ce42e50 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -144,10 +144,8 @@ ui_update(void) doupdate(); if (perform_resize) { - signal(SIGWINCH, SIG_IGN); - ui_resize(); perform_resize = FALSE; - signal(SIGWINCH, ui_sigwinch_handler); + ui_resize(); } }