[MPlayer-dev-eng] [PATCH] exit_player

Joey Parrish joey at nicewarrior.org
Thu Aug 12 02:29:15 CEST 2004


Hello,

This patch changes all exit() calls to exit_player() so that clean-up
always gets done right.

I just think this is a good idea in general.

--Joey

-- 
Me: "Isn't Kennedy as real as Colonel Sanders?"
Chad: "... Which Kennedy?"
-------------- next part --------------
always make sure exit_player gets called
the exit handler is important to me

diff -ur main.sofar/mplayer.c main.dev/mplayer.c
--- main.sofar/mplayer.c	2004-08-11 21:49:13.590256000 +0000
+++ main.dev/mplayer.c	2004-08-11 21:49:27.099681600 +0000
@@ -491,7 +491,7 @@
 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 || (inited_flags==0 && sig_count>1)) exit_player(NULL);
   if(sig_count>5){
     // can't stop :(
 #ifndef __MINGW32__
@@ -556,7 +556,7 @@
       close(conffile_fd);
     }
     if (m_config_parse_config_file(conf, conffile) < 0)
-      exit(1);
+      exit_player(NULL);
     free(conffile);
   }
 }
@@ -855,7 +855,7 @@
 
     playtree = m_config_parse_mp_command_line(mconfig, argc, argv);
     if(playtree == NULL)
-      exit(1);
+      exit_player(NULL);
 
     playtree = play_tree_cleanup(playtree);
     if(playtree) {
@@ -898,12 +898,12 @@
 
     if(video_driver_list && strcmp(video_driver_list[0],"help")==0){
       list_video_out();
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
 
     if(audio_driver_list && strcmp(audio_driver_list[0],"help")==0){
       list_audio_out();
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
 
 // check codec.conf
@@ -912,7 +912,7 @@
     if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){
       if(!parse_codec_cfg(NULL)){
 	mp_msg(MSGT_CPLAYER,MSGL_HINT,MSGTR_CopyCodecsConf);
-	exit(0);
+        exit_player_with_rc(NULL, 0);
       }
       mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_BuiltinCodecsConf);
     }
@@ -932,29 +932,29 @@
       mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableAudioCodecs);
       list_codecs(1);
       printf("\n");
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
     if(video_codec_list && strcmp(video_codec_list[0],"help")==0){
       mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableVideoCodecs);
       list_codecs(0);
       printf("\n");
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
     if(video_fm_list && strcmp(video_fm_list[0],"help")==0){
       vfm_help();
       printf("\n");
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
     if(audio_fm_list && strcmp(audio_fm_list[0],"help")==0){
       afm_help();
       printf("\n");
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
 #ifdef HAVE_X11
     if(vo_fstype_list && strcmp(vo_fstype_list[0],"help")==0){
       fstype_help();
       printf("\n");
-      exit(0);
+      exit_player_with_rc(NULL, 0);
     }
 #endif
 
@@ -1059,7 +1059,7 @@
       if(!use_gui){
 	// no file/vcd/dvd -> show HELP:
 	mp_msg(MSGT_CPLAYER, MSGL_INFO, help_text);
-	exit(0);
+        exit_player_with_rc(NULL, 0);
       } else gui_no_filename=1;
     }
 


More information about the MPlayer-dev-eng mailing list