Check if scene item is actually alive when calling obs_sceneitem_destroy

Prevents a double free in case the scene item was previously removed
This commit is contained in:
Palana
2014-01-29 22:52:05 +01:00
parent af03444cbe
commit 2fa208adfb

View File

@@ -302,7 +302,16 @@ int obs_sceneitem_destroy(obs_scene_t scene, obs_sceneitem_t item)
pthread_mutex_lock(&scene->mutex);
if (item) {
bool found = false;
obs_sceneitem_t i = scene->first_item;
while (i) {
if (i == item) {
found = true;
break;
}
}
if (found) {
struct calldata params = {0};
signal_item_destroy(item, &params);
calldata_free(&params);