UI: Move properties window creation for new sources

Currently creating new sources can cause a deadlock:
OBSBasicSourceSelect locks the scene mutex when adding a new source
(required to add invisible sources), and later OBSBasic tries to
lock the graphics mutex (via CreatePropertiesWindow); meanwhile the
graphics thread is holding the graphics mutex and tries to lock each
scene as it renders them, resulting in a (non-obvious from the code)
lock ordering conflict.

Moving the CreatePropertiesWindow call out of the locked scene mutex
restores the previous lock ordering; in addition, the requirement
for keeping sourceSceneRefs for opening that initial properties
window is removed
This commit is contained in:
Palana
2015-10-24 16:07:05 +02:00
parent c9b9811ff2
commit 6c193435cc
3 changed files with 8 additions and 8 deletions

View File

@@ -1266,8 +1266,6 @@ void OBSBasic::UpdateSources(OBSScene scene)
void OBSBasic::InsertSceneItem(obs_sceneitem_t *item)
{
obs_source_t *source = obs_sceneitem_get_source(item);
QListWidgetItem *listItem = new QListWidgetItem();
SetOBSRef(listItem, OBSSceneItem(item));
@@ -1275,10 +1273,6 @@ void OBSBasic::InsertSceneItem(obs_sceneitem_t *item)
ui->sources->setCurrentRow(0, QItemSelectionModel::ClearAndSelect);
SetupVisibilityItem(ui->sources, listItem, item);
/* if the source was just created, open properties dialog */
if (sourceSceneRefs[source] == 0 && loaded)
CreatePropertiesWindow(source);
}
void OBSBasic::CreateInteractionWindow(obs_source_t *source)
@@ -2732,6 +2726,8 @@ void OBSBasic::AddSource(const char *id)
if (id && *id) {
OBSBasicSourceSelect sourceSelect(this, id);
sourceSelect.exec();
if (sourceSelect.newSource)
CreatePropertiesWindow(sourceSelect.newSource);
}
}