about summary refs log tree commit diff stats
path: root/src/ui/core.c
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2022-04-01 10:40:53 +0300
committerPaul Fertser <fercerpav@gmail.com>2022-04-01 10:49:01 +0300
commite1323655ee2924cab5efd48fdb307e76b7d16b24 (patch)
tree1442f62d03c3a2686c4f550c65ab9a5aa4bf8d69 /src/ui/core.c
parent9a4cfa70efac52f35650b535a7110c0fd1f3bc79 (diff)
downloadprofani-tty-e1323655ee2924cab5efd48fdb307e76b7d16b24.tar.gz
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.
Diffstat (limited to 'src/ui/core.c')
-rw-r--r--src/ui/core.c4
1 files changed, 1 insertions, 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();
     }
 }