summaryrefslogtreecommitdiffstats
path: root/player/main.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-24 15:34:04 +0200
committerwm4 <wm4@nowhere>2014-10-24 15:34:04 +0200
commitdb86eaad3d1db3dbc631ae7dfa7a7f4b12f10ee8 (patch)
tree813bb713a7a9755a8f320098efb54f7ed77a480a /player/main.c
parent986d15ea9c61a76ed23bfccda8f3e943b6146115 (diff)
downloadmpv-db86eaad3d1db3dbc631ae7dfa7a7f4b12f10ee8.tar.bz2
mpv-db86eaad3d1db3dbc631ae7dfa7a7f4b12f10ee8.tar.xz
player: adjust uninit order of components
Most things should be allowed to access the client API unconditionally (for example for sending events), so move destroying the client API down. Also, mp_uninit_ipc() should happen before the point at which all clients are shutdown, or there will be a small time window in which new clients can be created after destroying them all.
Diffstat (limited to 'player/main.c')
-rw-r--r--player/main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/player/main.c b/player/main.c
index 90841f5fdf..defceb43e5 100644
--- a/player/main.c
+++ b/player/main.c
@@ -114,11 +114,15 @@ static void shutdown_clients(struct MPContext *mpctx)
mp_dispatch_queue_process(mpctx->dispatch, 0);
mp_wait_events(mpctx, 10000);
}
- mp_clients_destroy(mpctx);
}
void mp_destroy(struct MPContext *mpctx)
{
+#if !defined(__MINGW32__)
+ mp_uninit_ipc(mpctx->ipc_ctx);
+ mpctx->ipc_ctx = NULL;
+#endif
+
shutdown_clients(mpctx);
uninit_audio_out(mpctx);
@@ -131,13 +135,10 @@ void mp_destroy(struct MPContext *mpctx)
mpctx->encode_lavc_ctx = NULL;
-#if !defined(__MINGW32__)
- mp_uninit_ipc(mpctx->ipc_ctx);
- mpctx->ipc_ctx = NULL;
-#endif
-
command_uninit(mpctx);
+ mp_clients_destroy(mpctx);
+
osd_free(mpctx->osd);
if (mpctx->opts->use_terminal && terminal_initialized) {