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: 024e0cd4c1
This commit is contained in:
nanahi 2024-04-04 07:56:21 -04:00 committed by Kacper Michajłow
parent f4db4aaed7
commit e731972163
1 changed files with 8 additions and 2 deletions

View File

@ -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;
}