changeset 5830:4c17a92220fc

uninit libvo before getch2 - requires for clean svgalib uninit
author arpi
date Thu, 25 Apr 2002 13:27:15 +0000
parents 21935594d592
children 92f11ec38817
files mplayer.c
diffstat 1 files changed, 21 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Thu Apr 25 13:12:59 2002 +0000
+++ b/mplayer.c	Thu Apr 25 13:27:15 2002 +0000
@@ -286,6 +286,7 @@
 
   mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n*** uninit(0x%X)\n",mask);
 
+  // kill the cache process:
   if(mask&INITED_STREAM){
     inited_flags&=~INITED_STREAM;
     current_module="uninit_stream";
@@ -293,6 +294,14 @@
     stream=NULL;
   }
 
+  if(mask&INITED_VO){
+    inited_flags&=~INITED_VO;
+    current_module="uninit_vo";
+    video_out->uninit();
+    video_out=NULL;
+  }
+
+  // must be after libvo uninit, as few vo drivers (svgalib) has tty code
   if(mask&INITED_GETCH2){
     inited_flags&=~INITED_GETCH2;
     current_module="uninit_getch2";
@@ -308,13 +317,6 @@
     vo_spudec=NULL;
   }
 
-  if(mask&INITED_VO){
-    inited_flags&=~INITED_VO;
-    current_module="uninit_vo";
-    video_out->uninit();
-    video_out=NULL;
-  }
-
   if(mask&INITED_AO){
     inited_flags&=~INITED_AO;
     current_module="uninit_ao";
@@ -329,20 +331,20 @@
   }
 #endif
 
-#if defined(HAVE_LIRC) && ! defined(HAVE_NEW_INPUT)
+#ifdef HAVE_NEW_INPUT
+  if(mask&INITED_INPUT){
+    inited_flags&=INITED_INPUT;
+    current_module="uninit_input";
+    mp_input_uninit();
+  }
+#else
+#ifdef HAVE_LIRC
   if(mask&INITED_LIRC){
     inited_flags&=~INITED_LIRC;
     current_module="uninit_lirc";
     lirc_mp_cleanup();
   }
 #endif
-
-#ifdef HAVE_NEW_INPUT
-  if(mask&INITED_INPUT){
-    inited_flags&=INITED_INPUT;
-    current_module="uninit_input";
-    mp_input_uninit();
-  }
 #endif
 
   current_module=NULL;
@@ -364,14 +366,15 @@
 void exit_sighandler(int x){
   static int sig_count=0;
   ++sig_count;
-  if(sig_count==2) exit(1);
-  if(sig_count>2){
+  if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1);
+  if(sig_count>5){
     // can't stop :(
     kill(getpid(),SIGKILL);
   }
   mp_msg(MSGT_CPLAYER,MSGL_FATAL,"\n" MSGTR_IntBySignal,x,
       current_module?current_module:mp_gettext("unknown")
   );
+  if(sig_count==1)
   switch(x){
   case SIGINT:
   case SIGQUIT:
@@ -382,7 +385,7 @@
 #ifdef RUNTIME_CPUDETECT
       mp_msg(MSGT_CPLAYER,MSGL_FATAL,"- MPlayer crashed by 'Illegal Instruction'. It may be a bug in our new runtime cpu-detection code... please read DOCS/bugreports.html\n");
 #else
-      mp_msg(MSGT_CPLAYER,MSGL_FATAL,"- MPlayer crashed by 'Illegal Instruction'. It usually happens when you run it on different CPU than it was compiled for. Verify this!\n");
+      mp_msg(MSGT_CPLAYER,MSGL_FATAL,"- MPlayer crashed by 'Illegal Instruction'. It usually happens when you run it on different CPU than it was compiled/optimized for. Verify this!\n");
 #endif
   case SIGFPE:
   case SIGSEGV: