summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-04 03:46:11 +0200
committerwm4 <wm4@nowhere>2012-08-04 19:59:56 +0200
commit9a2f4e10e71aa1c0c2970f807fe14000861b602b (patch)
tree35785a60a5befd494de2a790b44d35d9bfa3a044 /command.c
parentc7be71ae710280f750c14973e303ec3550e94ec3 (diff)
downloadmpv-9a2f4e10e71aa1c0c2970f807fe14000861b602b.tar.bz2
mpv-9a2f4e10e71aa1c0c2970f807fe14000861b602b.tar.xz
mplayer: never exit mplayer from within the play loop
The only place exit_player() should be called is the main() function. exit_player() should be the only function allowed to call exit(). This makes it easier to guarantee proper deinitialization, and allows using the --leak-report flag without showing false positives. The quit slave command now sets a flag only. It uses the same mechanism that's normally used to advance to the next file on the playlist, so the rest of the playback path should be able to react to the quit command quickly enough. That is, the player should react just as fast to quit requests in practice as before this commit. In reinit_audio_chain(), the player was actually exited if init_audio_filters() failed. Reuse the normal error handling path to handle this condition.
Diffstat (limited to 'command.c')
-rw-r--r--command.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/command.c b/command.c
index 6ec37d4f26..83a0ca8755 100644
--- a/command.c
+++ b/command.c
@@ -2872,8 +2872,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
case MP_CMD_QUIT:
- exit_player_with_rc(mpctx, EXIT_QUIT,
- (cmd->nargs > 0) ? cmd->args[0].v.i : 0);
+ mpctx->stop_play = PT_QUIT;
+ mpctx->quit_player_rc = (cmd->nargs > 0) ? cmd->args[0].v.i : 0;
+ break;
case MP_CMD_PLAYLIST_NEXT:
case MP_CMD_PLAYLIST_PREV: