0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

libobs: Block sceneitem create if item source is removed

There are some cases where an item may attempt to be created for a
removed source.

Previously, items created from removed sources would lead to the item
itself being saved, but the underlying source not being saved. While
this does not break OBS immediately, it means that the source along
with all associated items will disappear on OBS reload.

This prevents the item from being created in the first place, reducing
the chances of user work being lost.
This commit is contained in:
tt2468 2021-09-13 00:42:21 -07:00 committed by Jim
parent 4614c0574e
commit 529a412840

View File

@ -1829,6 +1829,11 @@ static obs_sceneitem_t *obs_scene_add_internal(obs_scene_t *scene,
return NULL;
}
if (source->removed) {
blog(LOG_WARNING, "Tried to add a removed source to a scene");
return NULL;
}
if (pthread_mutex_init(&mutex, NULL) != 0) {
blog(LOG_WARNING, "Failed to create scene item mutex");
return NULL;