diff --git a/multistream.cpp b/multistream.cpp index 1430c83..e2a6ba3 100644 --- a/multistream.cpp +++ b/multistream.cpp @@ -430,6 +430,7 @@ MultistreamDock::~MultistreamDock() obs_service_release(service); } outputs.clear(); + obs_data_array_release(vertical_outputs); obs_data_release(current_config); obs_frontend_remove_event_callback(frontend_event, this); multistream_dock = nullptr; @@ -948,37 +949,26 @@ void MultistreamDock::LoadVerticalOutputs(bool firstLoad) return; } - auto outputs = (obs_data_array_t *)calldata_ptr(&cd, "outputs"); + if (vertical_outputs) + obs_data_array_release(vertical_outputs); + vertical_outputs = (obs_data_array_t *)calldata_ptr(&cd, "outputs"); + calldata_free(&cd); - auto count = obs_data_array_count(outputs); + auto count = obs_data_array_count(vertical_outputs); int idx = 0; while (auto item = verticalCanvasOutputLayout->itemAt(idx)) { auto streamGroup = item->widget(); - auto name = streamGroup->objectName(); - bool found = false; - for (size_t i = 0; i < count; i++) { - auto item = obs_data_array_item(outputs, i); - if (QString::fromUtf8(obs_data_get_string(item, "name")) == name) { - found = true; - } - obs_data_release(item); - } - if (!found) { - verticalCanvasOutputLayout->removeWidget(streamGroup); - RemoveWidget(streamGroup); - } else { - idx++; - } + verticalCanvasOutputLayout->removeWidget(streamGroup); + RemoveWidget(streamGroup); } obs_data_array_enum( - outputs, + vertical_outputs, [](obs_data_t *data, void *param) { auto d = (MultistreamDock *)param; d->LoadOutput(data, true); }, this); - obs_data_array_release(outputs); } void MultistreamDock::storeMainStreamEncoders() diff --git a/multistream.hpp b/multistream.hpp index 7e02c52..d4cee9c 100644 --- a/multistream.hpp +++ b/multistream.hpp @@ -35,6 +35,7 @@ private: std::vector oldVideo; std::vector> outputs; + obs_data_array_t *vertical_outputs = nullptr; bool exiting = false; void LoadSettingsFile();