Skip to content

Commit

Permalink
Link: add cyclic dependency check when change link
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Feb 15, 2018
1 parent 2cf0cca commit c144941
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/App/Link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,11 @@ void LinkBaseExtension::setLink(int index, DocumentObject *obj,
if(!parent)
LINK_THROW(Base::RuntimeError,"No parent container");

auto inSet = parent->getInListEx(true);
inSet.insert(parent);
if(inSet.find(obj)!=inSet.end())
LINK_THROW(Base::RuntimeError,"Cyclic dependency");

auto linkProp = getLinkedObjectProperty();

// If we are a group (i.e. no LinkObject property), and the index is
Expand Down

0 comments on commit c144941

Please sign in to comment.