diff options
author | wm4 <wm4@nowhere> | 2017-02-24 08:54:52 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-02-24 08:54:52 +0100 |
commit | eacf4a7d9b81bf13b917739b2ccd6e50a179b570 (patch) | |
tree | 4fc3babd9a03fe08a524714a1bc0a5d24614ff09 /player/client.c | |
parent | 6f8c953042a7a964686e5923f5c61025ef6b842e (diff) | |
download | mpv-eacf4a7d9b81bf13b917739b2ccd6e50a179b570.tar.bz2 mpv-eacf4a7d9b81bf13b917739b2ccd6e50a179b570.tar.xz |
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.
Diffstat (limited to 'player/client.c')
-rw-r--r-- | player/client.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); |