[MPlayer-dev-eng] [PATCH] signal handler may not call exit_player
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Jan 6 23:11:43 CET 2008
Hello,
attached patch removes the at once useless and completely broken call to
exit_player from the signal handler.
Instead, on the first of the "normal" signals (SIGTERM, SIGINT etc) it
generates quit commands (that one is a bit of an ugly hack I admit) and
later on just tries getch2_disable and the exit.
It certainly is not perfect but it should at least be much better than
the current code. Ok to apply?
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mplayer.c
===================================================================
--- mplayer.c (revision 25631)
+++ mplayer.c (working copy)
@@ -762,7 +759,8 @@
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);
@@ -796,7 +794,8 @@
}
#endif
}
- exit_player(NULL);
+ getch2_disable();
+ exit(1);
}
extern void mp_input_register_options(m_config_t* cfg);
Index: input/input.c
===================================================================
--- input/input.c (revision 25631)
+++ input/input.c (working copy)
@@ -541,6 +541,8 @@
// 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_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);
Index: input/input.h
===================================================================
--- input/input.h (revision 25631)
+++ input/input.h (working copy)
@@ -298,4 +298,6 @@
int
mp_input_check_interrupt(int time);
+extern int async_quit_request;
+
#endif /* INPUT_H */
More information about the MPlayer-dev-eng
mailing list