[Mplayer-cvslog] CVS: main mplayer.c,1.782,1.783

Roberto Togni CVS syncmail at mplayerhq.hu
Thu Sep 9 21:24:14 CEST 2004


CVS change done by Roberto Togni CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv19836

Modified Files:
	mplayer.c 
Log Message:
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



Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.782
retrieving revision 1.783
diff -u -r1.782 -r1.783
--- mplayer.c	6 Sep 2004 22:27:08 -0000	1.782
+++ mplayer.c	9 Sep 2004 19:24:12 -0000	1.783
@@ -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);




More information about the MPlayer-cvslog mailing list