From 01effaaab07a836b29a0d502c2dc696a3d807b9f Mon Sep 17 00:00:00 2001 From: Pieter Hijma Date: Tue, 22 Apr 2025 15:43:36 +0200 Subject: [PATCH] [Gui] Fix "Select dependent objects" with cycles Doing "Add dependent objects to selection" in the context menu of an object that has cyclic dependencies triggered an infinite recursive loop. This has been solved by using the function to get an outlist recursively. --- src/Gui/Tree.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 29fe23051a..a567b275f8 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1303,11 +1303,11 @@ void TreeWidget::addDependentToSelection(App::Document* doc, App::DocumentObject { // add the docObject to the selection Selection().addSelection(doc->getName(), docObject->getNameInDocument()); - // get the dependent - auto subObjectList = docObject->getOutList(); - // the dependent can in turn have dependents, thus add them recursively - for (auto itDepend = subObjectList.begin(); itDepend != subObjectList.end(); ++itDepend) - addDependentToSelection(doc, (*itDepend)); + // get the dependent objects recursively + auto subObjectList = docObject->getOutListRecursive(); + for (auto itDepend = subObjectList.begin(); itDepend != subObjectList.end(); ++itDepend) { + Selection().addSelection(doc->getName(), (*itDepend)->getNameInDocument()); + } } // add dependents of the selected tree object to selection