[MPlayer-cvslog] r25651 - in trunk: input/input.c input/input.h mplayer.c

reimar subversion at mplayerhq.hu
Tue Jan 8 22:40:45 CET 2008


Author: reimar
Date: Tue Jan  8 22:40:44 2008
New Revision: 25651

Log:
Do not use exit_player in the signal handler, this code just can not
be called from a signal handler.
Instead only make the input system generate quit commands for the first
CTRL+C and otherwise do getch2_disable and exit.


Modified:
   trunk/input/input.c
   trunk/input/input.h
   trunk/mplayer.c

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	(original)
+++ trunk/input/input.c	Tue Jan  8 22:40:44 2008
@@ -541,6 +541,8 @@ static mp_cmd_filter_t* cmd_filters = NU
 // Callback to allow the menu filter to grab the incoming keys
 int (*mp_input_key_cb)(int code) = NULL;
 
+int async_quit_request;
+
 static mp_input_fd_t key_fds[MP_MAX_KEY_FD];
 static unsigned int num_key_fd = 0;
 static mp_input_fd_t cmd_fds[MP_MAX_CMD_FD];
@@ -1312,6 +1314,8 @@ mp_input_get_cmd(int time, int paused, i
   mp_cmd_filter_t* cf;
   int from_queue;
 
+  if (async_quit_request)
+    return mp_input_parse_cmd("quit 1");
   while(1) {
     from_queue = 1;
     ret = mp_input_get_queued_cmd(peek_only);

Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h	(original)
+++ trunk/input/input.h	Tue Jan  8 22:40:44 2008
@@ -298,4 +298,6 @@ mp_input_uninit(void);
 int
 mp_input_check_interrupt(int time);
 
+extern int async_quit_request;
+
 #endif /* INPUT_H */

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Tue Jan  8 22:40:44 2008
@@ -764,7 +764,8 @@ static void exit_sighandler(int x){
   case SIGQUIT:
   case SIGTERM:
   case SIGKILL:
-      break;  // killed from keyboard (^C) or killed [-9]
+      async_quit_request = 1;
+      return;  // killed from keyboard (^C) or killed [-9]
   case SIGILL:
 #ifdef RUNTIME_CPUDETECT
       mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL_RTCpuSel);
@@ -798,7 +799,8 @@ static void exit_sighandler(int x){
       }
 #endif  
   }
-  exit_player(NULL);
+  getch2_disable();
+  exit(1);
 }
 
 extern void mp_input_register_options(m_config_t* cfg);



More information about the MPlayer-cvslog mailing list