diff --git a/src/Mod/Part/Gui/ViewProviderCompound.cpp b/src/Mod/Part/Gui/ViewProviderCompound.cpp index 3277fa6218..5008324949 100644 --- a/src/Mod/Part/Gui/ViewProviderCompound.cpp +++ b/src/Mod/Part/Gui/ViewProviderCompound.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,23 @@ bool ViewProviderCompound::onDelete(const std::vector& subNames) } for (auto pLink : pLinks) { - if (pLink) { + if (!pLink) { + continue; + } + + bool hasOtherParent = false; + for (auto parent : pLink->getInList()) { + if (parent && parent != pComp && parent->isDerivedFrom()) { + auto otherCompound = static_cast(parent); + auto otherLinks = otherCompound->Links.getValues(); + if (std::ranges::find(otherLinks, pLink) != otherLinks.end()) { + hasOtherParent = true; + break; + } + } + } + + if (!hasOtherParent) { Gui::Application::Instance->showViewProvider(pLink); } }