Fix crash vertical outputs dereferenced

This commit is contained in:
Exeldro 2024-07-31 12:02:07 +02:00
parent 6c4d065cb3
commit ba1e950e63
No known key found for this signature in database
GPG Key ID: 97269A83FC715751
2 changed files with 10 additions and 19 deletions

View File

@ -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()

View File

@ -35,6 +35,7 @@ private:
std::vector<video_t *> oldVideo;
std::vector<std::tuple<std::string, obs_output_t *, QPushButton *>> outputs;
obs_data_array_t *vertical_outputs = nullptr;
bool exiting = false;
void LoadSettingsFile();