commit 0880c3d1b36819168ade3e366629fbfdd8e45f2f
parent d2fc59d26a1d9cf7f3398660344268991e536c59
Author: inu <inu>
Date: Mon, 29 May 2006 12:28:01 +0000
[w3m-dev-en 01067] fix unsafe usage of SIGWINCH handler.
Diffstat:
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,4 +1,9 @@
-2006-04-08 Dai Sato <satodai@w3m.jp>
+2006-05-29 Dai Sato <satodai@w3m.jp>
+
+ * [w3m-dev-en 01067] Some more patches
+ * main.c: fix unsafe usages of SIGWINCH handler.
+
+2006-05-29 Dai Sato <satodai@w3m.jp>
* [w3m-dev-en 01067] Some more patches
* keybind(_lynx).c, doc(-jp)/keymap.default: add SHIFT-TAB as a default binding for PREV_LINK.
diff --git a/main.c b/main.c
@@ -51,7 +51,6 @@ static MySignalHandler SigAlarm(SIGNAL_ARG);
#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
@@ -1084,24 +1083,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);
@@ -1427,17 +1434,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)