Bläddra i källkod

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.
tt2468 4 år sedan
förälder
incheckning
529a412840
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      libobs/obs-scene.c

+ 5 - 0
libobs/obs-scene.c

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