Package: w3m Version: 0.5.1-4 Followup-For: Bug #336120 A patch to make the SIGWINCH handler safer. It works but a periodical check of need_resize_screen is needed (this could be avoided by a more cumbersome approach).
Karsten Schölzel -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (990, 'testing'), (500, 'unstable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.15 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
diff --git a/main.c b/main.c index 6721a31..ab0732a 100644 --- a/main.c +++ b/main.c @@ -51,7 +51,6 @@ static MySignalHandler SigAlarm(SIGNAL_A #ifdef SIGWINCH static int need_resize_screen = FALSE; static MySignalHandler resize_hook(SIGNAL_ARG); -static MySignalHandler resize_handler(SIGNAL_ARG); static void resize_screen(void); #endif @@ -1082,24 +1081,32 @@ main(int argc, char **argv, char **envp) } #endif #ifdef SIGWINCH - if (need_resize_screen) { - need_resize_screen = FALSE; - resize_screen(); - } - mySignal(SIGWINCH, resize_handler); + mySignal(SIGWINCH, resize_hook); #endif #ifdef USE_IMAGE if (activeImage && displayImage && Currentbuf->img && !Currentbuf->image_loaded) { do { +#ifdef SIGWINCH + if (need_resize_screen) + resize_screen(); +#endif loadImage(Currentbuf, IMG_FLAG_NEXT); } while (sleep_till_anykey(1, 0) <= 0); } +#ifdef SIGWINCH + else +#endif #endif - c = getch(); #ifdef SIGWINCH - mySignal(SIGWINCH, resize_hook); + { + do { + if (need_resize_screen) + resize_screen(); + } while (sleep_till_anykey(1, 0) <= 0); + } #endif + c = getch(); #ifdef USE_ALARM if (CurrentAlarm->sec > 0) { alarm(0); @@ -1416,17 +1423,10 @@ resize_hook(SIGNAL_ARG) SIGNAL_RETURN; } -static MySignalHandler -resize_handler(SIGNAL_ARG) -{ - resize_screen(); - mySignal(SIGWINCH, resize_handler); - SIGNAL_RETURN; -} - static void resize_screen(void) { + need_resize_screen = FALSE; setlinescols(); setupscreen(); if (CurrentTab)