# HG changeset patch # User rtognimp # Date 1094757852 0 # Node ID a7bde33bd7d889be1497c6a359c1d825aa568102 # Parent 0696c80374451ba6bc1bbf2a32ef80c6e9ed8cf2 Don't leave a messed up terminal after a crash Old way: crash: try uninit + exit (4 times) crash: try exit(1) crash: send self kill -9 With this patch: crash: try uninit + exit (4 times) crash: forget about the normal mplayer uninit codepaths and try restore terminal by force + exit crash: try exit crash: send self kill -9 Patch by Jan Knutar ( jknutar at nic dot fi ) Approved by alex diff -r 0696c8037445 -r a7bde33bd7d8 mplayer.c --- a/mplayer.c Thu Sep 09 18:36:15 2004 +0000 +++ b/mplayer.c Thu Sep 09 19:24:12 2004 +0000 @@ -490,8 +490,18 @@ static void exit_sighandler(int x){ static int sig_count=0; ++sig_count; - if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1); - if(sig_count>5){ + if(inited_flags==0 && sig_count>1) exit(1); + if(sig_count==5) + { + /* We're crashing bad and can't uninit cleanly :( + * by popular request, we make one last (dirty) + * effort to restore the user's + * terminal. */ + getch2_disable(); + exit(1); + } + if(sig_count==6) exit(1); + if(sig_count>6){ // can't stop :( #ifndef __MINGW32__ kill(getpid(),SIGKILL);