mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs: Fix crash in obs_sceneitem_remove()
when already removed
An already-removed item has a NULL `item->parent`, meaning that calling `full_lock(scene)` results in undefined behavior. This makes the method return earlier if the specified item is removed instead of attempting to lock the scene. No thread safety is changed, because it wasn't thread-safe to begin with.
This commit is contained in:
parent
ea1d022c20
commit
3e6797ca5b
|
@ -2254,19 +2254,13 @@ void obs_sceneitem_remove(obs_sceneitem_t *item)
|
|||
{
|
||||
obs_scene_t *scene;
|
||||
|
||||
if (!item)
|
||||
if (!item || item->removed)
|
||||
return;
|
||||
|
||||
scene = item->parent;
|
||||
|
||||
full_lock(scene);
|
||||
|
||||
if (item->removed) {
|
||||
if (scene)
|
||||
full_unlock(scene);
|
||||
return;
|
||||
}
|
||||
|
||||
item->removed = true;
|
||||
|
||||
assert(scene != NULL);
|
||||
|
|
Loading…
Reference in a new issue