bug-ncurses
[Top][All Lists]
Advanced

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

Re: core dump in torture test


From: Thomas Dickey
Subject: Re: core dump in torture test
Date: Sat, 19 Oct 2002 16:35:13 -0400
User-agent: Mutt/1.3.27i

On Sat, Oct 19, 2002 at 04:02:48PM -0400, Lucas Gonze wrote:
> 
> Compile and run the enclosed code in a terminal -- I'm using konsole.  
> Grab the right terminal border and resize back and forth, fast, about 20
> times.
> 
> Crash.
> 
> In the following, the crash only occurs if the window has contents.  As it
> stands there is a single label in the window.  If I remove the label the
> crash goes away.  

Reading quickly, it seems your sigwinch handler is calling code that
can break things (malloc and stdio stuff).  There's not much you can
do in a signal handler if you're planning to come back to the interrupted
program, other than set variables to tell that an interrupt occurred.

>   void recalc_window(){
> 
>     if( !cdkscreen )
>       return;
> 
>     // reinitialize the screen to match new coordinates
>     destroyCDKScreen (cdkscreen);
>     endCDK();
>     init_screen();
> 
>     // redraw to pickup changes
>     refreshCDKScreen(cdkscreen);
> 
>   }
...
> void winchange_handler(int signo){
>   signal(SIGCHLD, SIG_IGN); // don't get stuck in a recursive call
>   if( victim == NULL ){
>     // not initialized yet, so there's no window to change
>     signal(SIGWINCH, winchange_handler);
>     return;
>   }
>   victim->recalc_window();
>   signal(SIGWINCH, winchange_handler);
> }
...
> int main (int argc, char **argv){
> 
>   signal(SIGWINCH, winchange_handler);
> 
>   victim = new TortureTestWindow();
>   victim->wait_for_any_key();  
>   delete victim;
> }

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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