From 2197783d4611b71458d1a4c6f068c1077dfe2fa0 Mon Sep 17 00:00:00 2001 From: Pieter Hijma Date: Thu, 11 Sep 2025 12:07:45 +0200 Subject: [PATCH] Gui: Fix segfault DlgPropertyLink In some cases FreeCAD can segfault when signals to the selection model aren't blocked. --- src/Gui/Dialogs/DlgPropertyLink.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Gui/Dialogs/DlgPropertyLink.cpp b/src/Gui/Dialogs/DlgPropertyLink.cpp index 9ec2e93bf6..b135c14347 100644 --- a/src/Gui/Dialogs/DlgPropertyLink.cpp +++ b/src/Gui/Dialogs/DlgPropertyLink.cpp @@ -383,14 +383,16 @@ void DlgPropertyLink::init(const App::DocumentObjectT& prop, bool tryFilter) // Try to select items corresponding to the current links inside the // property - ui->treeWidget->blockSignals(true); - for (auto& link : oldLinks) { - onSelectionChanged(Gui::SelectionChanges(SelectionChanges::AddSelection, - link.getDocumentName(), - link.getObjectName(), - link.getSubName())); + { + QSignalBlocker blockTree(ui->treeWidget); + QSignalBlocker blockSelectionModel(ui->treeWidget->selectionModel()); + for (auto& link : oldLinks) { + onSelectionChanged(Gui::SelectionChanges(SelectionChanges::AddSelection, + link.getDocumentName(), + link.getObjectName(), + link.getSubName())); + } } - ui->treeWidget->blockSignals(false); // For link list type property, try to auto filter type if (tryFilter && isLinkList) {