mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-27 05:49:38 +08:00
client API: fix freeze when destroying mpv_handle before mpv_initialize
We have to perform some silly acrobatics to make the playback_thread() exit, as the mpv_command() will error out with MPV_ERROR_UNINITIALIZED. Test case: mpv_terminate_destroy(mpv_create()) Reported by a user on IRC.
This commit is contained in:
+7
-1
@@ -407,7 +407,13 @@ void mpv_terminate_destroy(mpv_handle *ctx)
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
mpv_command(ctx, (const char*[]){"quit", NULL});
|
||||
if (ctx->mpctx->initialized) {
|
||||
mpv_command(ctx, (const char*[]){"quit", NULL});
|
||||
} else {
|
||||
mp_dispatch_lock(ctx->mpctx->dispatch);
|
||||
ctx->mpctx->stop_play = PT_QUIT;
|
||||
mp_dispatch_unlock(ctx->mpctx->dispatch);
|
||||
}
|
||||
|
||||
if (!ctx->owner) {
|
||||
mpv_detach_destroy(ctx);
|
||||
|
||||
Reference in New Issue
Block a user