mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
Use mutex instead of variable for RC check
This commit is contained in:
parent
103ef75310
commit
f2e1ce533c
|
@ -331,19 +331,30 @@ int obs_sceneitem_release(obs_sceneitem_t item)
|
|||
void obs_sceneitem_remove(obs_sceneitem_t item)
|
||||
{
|
||||
obs_scene_t scene;
|
||||
bool was_removed;
|
||||
|
||||
if (item->removed)
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item->removed = true;
|
||||
|
||||
signal_item_remove(item);
|
||||
|
||||
scene = item->parent;
|
||||
|
||||
pthread_mutex_lock(&scene->mutex);
|
||||
if (scene)
|
||||
pthread_mutex_lock(&scene->mutex);
|
||||
|
||||
was_removed = item->removed;
|
||||
item->removed = true;
|
||||
|
||||
if (was_removed) {
|
||||
if (scene)
|
||||
pthread_mutex_unlock(&scene->mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
signal_item_remove(item);
|
||||
detach_sceneitem(item);
|
||||
pthread_mutex_unlock(&scene->mutex);
|
||||
|
||||
if (scene)
|
||||
pthread_mutex_unlock(&scene->mutex);
|
||||
|
||||
obs_sceneitem_release(item);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue