Mercurial > mplayer.hg
changeset 13298:a7bde33bd7d8
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
author | rtognimp |
---|---|
date | Thu, 09 Sep 2004 19:24:12 +0000 |
parents | 0696c8037445 |
children | 6f8fe531dd73 |
files | mplayer.c |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);