From d085d6e4a117152a8924eb63532d004bc9e281ff Mon Sep 17 00:00:00 2001 From: Palana Date: Tue, 17 Feb 2015 12:28:09 +0100 Subject: [PATCH] libobs: Allow duplicate sources per scene Previously having a source multiple times in a single scene would cause the recursion check to trigger. Example scenes.json: { "current_scene": "Scene", "sources": [ { "flags": 0, "id": "scene", "mixers": 0, "name": "Scene", "settings": { "items": [ { "align": 5, "bounds": { "x": 0.0, "y": 0.0 }, "bounds_align": 0, "bounds_type": 0, "name": "Text (FreeType 2)", "pos": { "x": 0.0, "y": 0.0 }, "rot": 0.0, "scale": { "x": 1.0, "y": 1.0 }, "visible": true }, { "align": 5, "bounds": { "x": 0.0, "y": 0.0 }, "bounds_align": 0, "bounds_type": 0, "name": "Text (FreeType 2)", "pos": { "x": 0.0, "y": 98.0 }, "rot": 0.0, "scale": { "x": 1.0, "y": 1.0 }, "visible": true } ] }, "sync": 0, "volume": 1.0 }, { "flags": 0, "id": "text_ft2_source", "mixers": 0, "name": "Text (FreeType 2)", "settings": {}, "sync": 0, "volume": 1.0 } ] } --- libobs/obs-source.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 95c5e41f8..5dd8cb5c2 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -2085,10 +2085,10 @@ static void check_descendant(obs_source_t *parent, obs_source_t *child, bool obs_source_add_child(obs_source_t *parent, obs_source_t *child) { - struct descendant_info info = {false, child}; - if (!parent || !child) return false; + struct descendant_info info = {false, parent}; + if (!parent || !child || parent == child) return false; - obs_source_enum_tree(parent, check_descendant, &info); + obs_source_enum_tree(child, check_descendant, &info); if (info.exists) return false;