Skip to content

Commit

Permalink
App::Link : deleting it deletes its elements if any
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddleStroke authored Mar 6, 2025
1 parent b864b46 commit dcaddb9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Gui/ViewProviderLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2384,8 +2384,19 @@ bool ViewProviderLink::getDetailPath(

bool ViewProviderLink::onDelete(const std::vector<std::string> &) {
auto element = getObject<App::LinkElement>();
if (element && !element->canDelete())
if (element && !element->canDelete()) {
return false;
}

auto link = getObject<App::Link>();
if (link->ElementCount.getValue() != 0) {
auto doc = link->getDocument();
auto elements = link->ElementList.getValues();
for (auto element : elements) {
doc->removeObject(element->getNameInDocument());
}
}

auto ext = getLinkExtension();
if (ext->isLinkMutated()) {
auto linked = ext->getLinkedObjectValue();
Expand Down

0 comments on commit dcaddb9

Please sign in to comment.