diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-04-04 07:56:21 -0400 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2024-04-17 23:42:35 +0200 |
commit | e731972163db1e00b3408692c88226ea3bf00814 (patch) | |
tree | 30b58bc82f227bede08ee4ec8dd074404a4b6fd0 /sub/dec_sub.c | |
parent | f4db4aaed720eecdb24533bc82c3a6137fd20067 (diff) | |
download | mpv-e731972163db1e00b3408692c88226ea3bf00814.tar.bz2 mpv-e731972163db1e00b3408692c88226ea3bf00814.tar.xz |
dec_sub: fix locking for sub_is_{primary,secondary}_visible
These public functions should use locks to keep its usage
consistent with input.c.
Fixes: 024e0cd4c1405a41edd6a8b302ec6b747bc60ea3
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r-- | sub/dec_sub.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 94ff3ba4dd..dab5abc69a 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -548,10 +548,16 @@ void sub_set_play_dir(struct dec_sub *sub, int dir) bool sub_is_primary_visible(struct dec_sub *sub) { - return sub->shared_opts->sub_visibility[0]; + mp_mutex_lock(&sub->lock); + bool ret = sub->shared_opts->sub_visibility[0]; + mp_mutex_unlock(&sub->lock); + return ret; } bool sub_is_secondary_visible(struct dec_sub *sub) { - return sub->shared_opts->sub_visibility[1]; + mp_mutex_lock(&sub->lock); + bool ret = sub->shared_opts->sub_visibility[1]; + mp_mutex_unlock(&sub->lock); + return ret; } |