From 52ca7d905baef7598ed1029398055c687eccd186 Mon Sep 17 00:00:00 2001 From: Warchamp7 Date: Thu, 15 Jan 2026 12:07:40 -0500 Subject: [PATCH] frontend: Move source selection handling to parent --- frontend/components/SourceTree.cpp | 10 ++++++++++ frontend/components/SourceTreeItem.cpp | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/components/SourceTree.cpp b/frontend/components/SourceTree.cpp index 9ffb7da35..9dff94950 100644 --- a/frontend/components/SourceTree.cpp +++ b/frontend/components/SourceTree.cpp @@ -415,6 +415,12 @@ void SourceTree::dropEvent(QDropEvent *event) void SourceTree::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { + // Avoids a crash during startup due to a circular call to OBSBasic which is still in its constructor. + // This is a symptom of the entire event hierarchy with the SourceTree being messy. + if (selected.size() == 0 && deselected.size() == 0) { + return; + } + { QSignalBlocker sourcesSignalBlocker(this); SourceTreeModel *stm = GetStm(); @@ -431,7 +437,11 @@ void SourceTree::selectionChanged(const QItemSelection &selected, const QItemSel int idx = deselectedIdxs[i].row(); obs_sceneitem_select(stm->items[idx], false); } + + OBSBasic::Get()->UpdateContextBarDeferred(); + OBSBasic::Get()->UpdateEditMenu(); } + QListView::selectionChanged(selected, deselected); } diff --git a/frontend/components/SourceTreeItem.cpp b/frontend/components/SourceTreeItem.cpp index 9d7971e28..35d2d9256 100644 --- a/frontend/components/SourceTreeItem.cpp +++ b/frontend/components/SourceTreeItem.cpp @@ -563,13 +563,9 @@ void SourceTreeItem::ExpandClicked(bool checked) void SourceTreeItem::Select() { tree->SelectItem(sceneitem, true); - OBSBasic::Get()->UpdateContextBarDeferred(); - OBSBasic::Get()->UpdateEditMenu(); } void SourceTreeItem::Deselect() { tree->SelectItem(sceneitem, false); - OBSBasic::Get()->UpdateContextBarDeferred(); - OBSBasic::Get()->UpdateEditMenu(); }