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.
This commit is contained in:
wm4 2014-10-24 15:34:04 +02:00
parent 986d15ea9c
commit db86eaad3d
1 changed files with 7 additions and 6 deletions

View File

@ -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) {