From 2edf00fb94ba18dc2d476e0354036043ce4f714d Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 9 Mar 2018 11:53:48 +0100 Subject: client API: send MPV_EVENT_SHUTDOWN only once Before this change, mpv_wait_event() could inconsistently return multiple MPV_EVENT_SHUTDOWN events to a single mpv_handle, up to the point of spamming the event queue under certain circumstances. Change this and just send it exactly once to each mpv_handle. Some client API users might have weird requirements about destroying their state asynchronously (and not reacting immediately to the SHUTDOWN event). This change will help a bit to make this less weird and surprising. --- player/client.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'player/client.c') diff --git a/player/client.c b/player/client.c index 289508447b..3bad543c98 100644 --- a/player/client.c +++ b/player/client.c @@ -634,6 +634,8 @@ static int append_event(struct mpv_handle *ctx, struct mpv_event event, bool cop ctx->events[(ctx->first_event + ctx->num_events) % ctx->max_events] = event; ctx->num_events++; wakeup_client(ctx); + if (event.event_id == MPV_EVENT_SHUTDOWN) + ctx->event_mask &= ctx->event_mask & ~(1ULL << MPV_EVENT_SHUTDOWN); return 0; } -- cgit v1.2.3