From 5e2779b2da089dda8f7e0e1814a37cdd2dffa357 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 25 Oct 2019 15:14:05 +0200 Subject: client API: copy instead of move old value on async path In theory, it's better to keep the old value, because that's more consistent with the logic of using change timestamps. With the current code, the old value will probably never be used (instead it will fetch a new value on every change), so this shouldn't make a difference in practice. --- player/client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/player/client.c b/player/client.c index 6d95faae48..3462845aed 100644 --- a/player/client.c +++ b/player/client.c @@ -1593,11 +1593,8 @@ static bool update_prop(struct mpv_handle *ctx, struct observe_property *prop) return false; // re-update later when the changed value comes in } - // Move to val - memcpy(&val, &prop->async_value, prop->type->type->size); + m_option_copy(prop->type, &val, &prop->async_value); val_valid = prop->async_value_valid; - prop->async_value = (union m_option_value){0}; - prop->async_value_valid = false; } else { pthread_mutex_unlock(&ctx->lock); -- cgit v1.2.3