[w3m-dev-en 01067] fix unsafe usage of SIGWINCH handler.

This commit is contained in:
Dai Sato
2006-05-29 12:28:01 +00:00
parent e6af15c579
commit 44366cf8a5
2 changed files with 25 additions and 20 deletions
+7 -2
View File
@@ -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.
@@ -8713,4 +8718,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
$Id: ChangeLog,v 1.961 2006/05/29 12:17:24 inu Exp $
$Id: ChangeLog,v 1.962 2006/05/29 12:28:01 inu Exp $
+18 -18
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.250 2006/04/08 11:21:07 inu Exp $ */
/* $Id: main.c,v 1.251 2006/05/29 12:28:01 inu Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -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
#ifdef SIGWINCH
{
do {
if (need_resize_screen)
resize_screen();
} while (sleep_till_anykey(1, 0) <= 0);
}
#endif
c = getch();
#ifdef SIGWINCH
mySignal(SIGWINCH, resize_hook);
#endif
#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)