Gui: Fix segfault DlgPropertyLink

In some cases FreeCAD can segfault when signals to the selection model
aren't blocked.
This commit is contained in:
Pieter Hijma
2025-09-11 12:07:45 +02:00
committed by Chris Hennes
parent 22b2a7cd56
commit 2197783d46

View File

@@ -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) {