mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-18 03:08:46 -05:00
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:
@@ -114,7 +114,7 @@ static void AddExisting(const char *name, const bool visible)
|
||||
}
|
||||
|
||||
bool AddNew(QWidget *parent, const char *id, const char *name,
|
||||
const bool visible)
|
||||
const bool visible, OBSSource &newSource)
|
||||
{
|
||||
obs_source_t *source = obs_get_output_source(0);
|
||||
obs_scene_t *scene = obs_scene_from_source(source);
|
||||
@@ -140,6 +140,8 @@ bool AddNew(QWidget *parent, const char *id, const char *name,
|
||||
data.visible = visible;
|
||||
obs_scene_atomic_update(scene, AddSource, &data);
|
||||
|
||||
newSource = source;
|
||||
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@@ -170,7 +172,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
}
|
||||
|
||||
if (!AddNew(this, id, QT_TO_UTF8(ui->sourceName->text()),
|
||||
visible))
|
||||
visible, newSource))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user