mirror of https://github.com/mpv-player/mpv
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:
parent
e552f5342e
commit
ac98ff71dd
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue