Skip to content

Commit

Permalink
Fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Jul 30, 2024
1 parent a250d7a commit 7b75b1f
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions multistream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ MultistreamDock::~MultistreamDock()
obs_output_release(old);
obs_service_release(service);
}
outputs.clear();
obs_data_release(current_config);
obs_frontend_remove_event_callback(frontend_event, this);
multistream_dock = nullptr;
Expand Down Expand Up @@ -587,7 +588,10 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
for (auto it = outputs.begin(); it != outputs.end(); it++) {
if (std::get<std::string>(*it) != name)
continue;
obs_output_force_stop(std::get<obs_output *>(*it));
obs_queue_task(
OBS_TASK_GRAPHICS,
[](void *param) { obs_output_force_stop((obs_output_t *)param); },
std::get<obs_output *>(*it), false);
}
}
outputButtonStyle(streamButton);
Expand Down Expand Up @@ -867,10 +871,13 @@ void MultistreamDock::stream_output_start(void *data, calldata_t *calldata)
continue;
auto button = std::get<QPushButton *>(*it);
if (!button->isChecked()) {
QMetaObject::invokeMethod(button, [button, md] {
button->setChecked(true);
md->outputButtonStyle(button);
});
QMetaObject::invokeMethod(
button,
[button, md] {
button->setChecked(true);
md->outputButtonStyle(button);
},
Qt::QueuedConnection);
}
}
}
Expand All @@ -884,14 +891,18 @@ void MultistreamDock::stream_output_stop(void *data, calldata_t *calldata)
continue;
auto button = std::get<QPushButton *>(*it);
if (button->isChecked()) {
QMetaObject::invokeMethod(button, [button, md] {
button->setChecked(false);
md->outputButtonStyle(button);
});
QMetaObject::invokeMethod(
button,
[button, md] {
button->setChecked(false);
md->outputButtonStyle(button);
},
Qt::QueuedConnection);
}
//obs_output_release(output);
//md->outputs.erase(it);
//break;
QMetaObject::invokeMethod(
button, [output] { obs_output_release(output); }, Qt::QueuedConnection);
md->outputs.erase(it);
break;
}
//const char *last_error = (const char *)calldata_ptr(calldata, "last_error");
}
Expand Down

0 comments on commit 7b75b1f

Please sign in to comment.