bug-ncurses
[Top][All Lists]
Advanced

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

Re: Strange ncurses bug with getch() and window resize?


From: Thomas Dickey
Subject: Re: Strange ncurses bug with getch() and window resize?
Date: Fri, 4 Aug 2006 19:30:24 -0400 (EDT)

On Fri, 4 Aug 2006, Simon Stelling wrote:

I'm writing a tool that uses ncurses to draw. When the xterm window is resized, I have to update a menu to reflect the changes, which works just fine. The app continues to work just fine until the very moment where i hit one of the arrow keys or any other special key.

My app is using a

while ((c = wgetch(inner)) != 'q') {
        switch (c) {
                case 's': ... break;
                case KEY_RESIZE: ... break;

scheme to get the user input. Hitting special keys prior to a window resize works just fine. After resizing, it does not matter whether there is a "case KEY_" for the special key or not; it exits either way. (There is no default: case, btw.)

I believe this a bug in ncurses, although I am not absolutely sure.

hmm. I downloaded the program (will do that _once_ - make a tar file of it if you want to pursue this), and tried running it. The program dumps core immediately. Here's the relevant chunk from valgrind:

==10384== 1 errors in context 1 of 1:
==10384== Invalid read of size 1
==10384==    at 0x421427D: fclose@@GLIBC_2.1 (iofclose.c:52)
==10384==    by 0x804AB93: sanity_checks (helpers.c:224)
==10384==    by 0x804B6EE: main (conf-update.c:29)
==10384==  Address 0x46 is not stack'd, malloc'd or (recently) free'd

Unfortunately I am unable to reproduce the issue from within gdb, for some reason it never triggers the case KEY_RESIZE: code, even if I tell gdb to pass the SIGWINCH signal or try to send it manually.

The code is available here:

http://sources.gentoo.org/viewcvs.py/portage/private/blubb/conf-update/conf-update.c?view=annotate

The "while ((c = wgetch(inner))..." is located around line 213.

I also attach the output of `strace -o ./conf-update' in the hope of it being useful.

not really (that sort of thing can be left for downloading from your site).

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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