From eacf4a7d9b81bf13b917739b2ccd6e50a179b570 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 24 Feb 2017 08:54:52 +0100 Subject: client: call certain external functions outside of client lock Fixes theoretical lock-order issues found by Coverity. Calling these inside the log is unnecessary anyway, because they have their own locking, and because mpv_detach_destroy() needs to be called by someone who has exclusive access to the mpv_handle (it's basically a destructor function). The lock order issues comes from the fact that they call back into the client API implementation to broadcast events and such. --- player/client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/client.c b/player/client.c index 31a55332d2..85ee3862c0 100644 --- a/player/client.c +++ b/player/client.c @@ -366,6 +366,9 @@ void mpv_detach_destroy(mpv_handle *ctx) // causes a crash, block until all asynchronous requests were served. mpv_wait_async_requests(ctx); + osd_set_external(ctx->mpctx->osd, ctx, 0, 0, NULL); + mp_input_remove_sections_by_owner(ctx->mpctx->input, ctx->name); + struct mp_client_api *clients = ctx->clients; pthread_mutex_lock(&clients->lock); @@ -378,8 +381,6 @@ void mpv_detach_destroy(mpv_handle *ctx) ctx->num_events--; } mp_msg_log_buffer_destroy(ctx->messages); - osd_set_external(ctx->mpctx->osd, ctx, 0, 0, NULL); - mp_input_remove_sections_by_owner(ctx->mpctx->input, ctx->name); pthread_cond_destroy(&ctx->wakeup); pthread_mutex_destroy(&ctx->wakeup_lock); pthread_mutex_destroy(&ctx->lock); -- cgit v1.2.3