From db86eaad3d1db3dbc631ae7dfa7a7f4b12f10ee8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 24 Oct 2014 15:34:04 +0200 Subject: 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. --- player/main.c | 13 +++++++------ 1 file 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) { -- cgit v1.2.3