id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,blockedby,blocking,branch_state,votes 2416,Closing the window with mc leaves it in background consuming 100% CPU,zap,,"I've compiled mc 4.7.4 on Nokia N900 (debian-based Maemo5 OS) with ncurses support. When you close the terminal (gnome-terminal based) with Midnight running in it, the mc process will remain in background, consuming 100% CPU. I've connected to the running mc process with gdb, here's the backtrace: Program received signal SIGINT, Interrupt. 0x400432f0 in _nc_wgetch () from /usr/lib/libncursesw.so.5 0x400432f0 <_nc_wgetch+28>: str r2, [r11, #-184] (gdb) where #0 0x400432f0 in _nc_wgetch () from /usr/lib/libncursesw.so.5 #1 0x40043cf0 in wgetch () from /usr/lib/libncursesw.so.5 #2 0x0007e7d8 in tty_lowlevel_getch () at tty-ncurses.c:242 #3 0x00096964 in get_key_code (no_delay=0) at key.c:1435 #4 0x00094c40 in getch_with_delay () at key.c:657 #5 0x000975e8 in tty_get_event (event=0xbeb6e33c, redo_event=0, block=1) at key.c:1684 #6 0x0001f804 in frontend_run_dlg (h=0x17a478) at dialog.c:1043 #7 0x0001f930 in run_dlg (h=0x17a478) at dialog.c:1075 #8 0x00072290 in create_panels_and_run_mc () at main.c:1716 #9 0x00072578 in do_nc () at main.c:1798 #10 0x00072c38 in main (argc=3, argv=0xbeb6e5a4) at main.c:2048 So, mc is still trying to read the keyboard, despite the fact that stdin has been already closed. - getch() returns -1 - tty_lowlevel_getch() returns -1 - get_key_code returns -1 as well then in getch_with_delay() it gets this: 657 c = get_key_code (0); 658 if (c != -1) 659 break; 660 /* Failed -> wait 0.1 secs and try again */ 661 try_channels (1); so it calls getch() again and again, despite the fact that getch() returns EOF.",defect,closed,major,,mc-tty,,duplicate,,,,,,