bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Inconsistent wgetch/SIGWINCH handler behavior


From: Dave Ulrick
Subject: RE: Inconsistent wgetch/SIGWINCH handler behavior
Date: Fri, 3 Jun 2005 23:50:59 -0500 (CDT)

OK, I've got a test program that illustrates the problem. Here's the source:


/* keytest.c */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <stdarg.h>
#include <limits.h>
#include <assert.h>
#include <errno.h>
#include <setjmp.h>
#include <ncurses.h>
#include "nvideo.h"



int main (int argc,
          char *argv[])
{
    int ch;

    initscr ();
    raw ();
    noecho ();
    nonl ();
    keypad (stdscr, TRUE);
    intrflush (stdscr, FALSE);
    meta (stdscr, TRUE);
    scrollok (stdscr, TRUE);

    clear ();
    addstr ("ncurses keyboard test\n");
    addstr ("press any key or ^C to exit\n");

    while ((ch = wgetch (stdscr)) != CTRL('C'))
        printw ("ch=%c, dec=%d, label=%s\n",
                (char)ch, (int)ch, keylabel (ch));

    refresh ();
    endwin ();

    return EXIT_SUCCESS;
}


nvideo.h is for a function I've written to display the special key labels: keylabel. If I run my program on my FC2 system and resize the window in which it runs, I get output like this:

ncurses keyboard test
press any key or ^C to exit
ch=~Z, dec=410, label=KEY_RESIZE
ch=, dec=-1, label=
ch=~Z, dec=410, label=KEY_RESIZE
ch=, dec=-1, label=
ch=~Z, dec=410, label=KEY_RESIZE
ch=, dec=-1, label=

On the SuSE 9.1 system, I get this:

ch=, dec=-1, label=
ch=, dec=-1, label=
ch=, dec=-1, label=
ch=, dec=-1, label=
ch=, dec=-1, label=
ch=, dec=-1, label=
ch=, dec=-1, label=
ch=, dec=-1, label=

I hope this helps to better illustrate my problem.

Incidentally, I'm having a bit of a problem when I use my SIGWINCH handler on one of my FC2 systems. If I rapidly resize the window, my program core dumps with this backtrace:

#0  0x032e8cb6 in TransformLine (lineno=32)
    at ../../ncurses/tty/tty_update.c:1083
#1  0x032e8659 in ClrUpdate () at ../../ncurses/tty/tty_update.c:900
#2  0x032e8082 in doupdate () at ../../ncurses/tty/tty_update.c:766
#3  0x032e3057 in wrefresh (win=0x9d9b1e8)
    at ../../ncurses/base/lib_refresh.c:58
#4 0x032ddbcc in _nc_wgetch (win=0x9d9b1e8, result=0xbff97e60, use_meta=1)
    at ../../ncurses/base/lib_getch.c:295
#5  0x032ddcc8 in wgetch (win=0x1) at ../../ncurses/base/lib_getch.c:467
#6  0x08050170 in win_getchar (win=0x9d9b1e8) at nvideo.c:619
#7  0x0806ba14 in sel_menu (menu=0xbff97f50, game=0xbff9b3c0,
    wordhdr=0xbff9b350, path=0x806beb4 "/usr/local/share/quote",
    pattern=0x806c2db "*.layout") at select.c:629
#8  0x0804b37e in main (argc=0, argv=0xbff9c66c) at quote.c:743

As I mentioned earlier, I borrowed my SIGWINCH handler from view.c in the ncurses 4.5 test directory. This signal handler runs without core dumps on my other FC2 system and my SuSE system. The system that has the core dumps is the slowest of the three, a PIII 600, with the other two being P4 2.66 and 3.00 GHz. Any suggestions on what I might do to prevent these core dumps?

Dave
--
Dave Ulrick
Email: address@hidden
Web:   http://www.niu.edu/~ulrick/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]