1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 19:52:14 +00:00

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


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13299 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rtognimp 2004-09-09 19:24:12 +00:00
parent 2e6733cb05
commit f50e3682eb

View File

@ -490,8 +490,18 @@ void exit_player(char* how){
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);