gfx-source-texture: Release child source if add_active_child fails

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-01-27 23:33:38 +01:00
parent 10c0081f32
commit 97bf38633b

View file

@ -57,6 +57,7 @@ gfx::source_texture::source_texture(const char* _name, obs_source_t* _parent) :
throw std::invalid_argument("source does not exist"); throw std::invalid_argument("source does not exist");
} }
if (!obs_source_add_active_child(_parent, source)) { if (!obs_source_add_active_child(_parent, source)) {
obs_source_release(source);
throw std::runtime_error("parent is contained in child"); throw std::runtime_error("parent is contained in child");
} }
child = std::make_unique<obs::source>(source, true, true); child = std::make_unique<obs::source>(source, true, true);