Skip to content

Commit

Permalink
Gui.TreeWidget: check cyclic dep when populating
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed Mar 26, 2017
1 parent a5dead1 commit f323b8c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Gui/Tree.cpp
Expand Up @@ -1109,7 +1109,7 @@ void DocumentItem::populateItem(DocumentObjectItem *item, bool refresh) {

const char* name = child->getNameInDocument();
if (!name) {
Base::Console().Warning("Gui::DocumentItem::populate(): Cannot reparent unknown object.\n");
Base::Console().Warning("Gui::DocumentItem::populateItem(): Cannot reparent unknown object.\n");
continue;
}

Expand All @@ -1127,6 +1127,12 @@ void DocumentItem::populateItem(DocumentObjectItem *item, bool refresh) {
if(childItem->parent() != this)
slotNewObject(item,*childItem->object());
else {
if(item->isChildOfItem(childItem)) {
Base::Console().Error("Gui::DocumentItem::populateItem(): Cyclic dependency in %s and %s\n",
item->object()->getObject()->Label.getValue(),
childItem->object()->getObject()->Label.getValue());
continue;
}
this->removeChild(childItem);
item->addChild(childItem);
}
Expand Down Expand Up @@ -1575,7 +1581,5 @@ void DocumentObjectItem::slotChangeStatusTip(const QString& tip)
this->setStatusTip(0, tip);
}



#include "moc_Tree.cpp"

0 comments on commit f323b8c

Please sign in to comment.