Gui.TreeWidget: check cyclic dep when populating

This commit is contained in:
Zheng, Lei
2017-03-16 12:27:16 +08:00
committed by wmayer
parent 92ea1ac578
commit 1b183a16b8

View File

@@ -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;
}
@@ -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);
}
@@ -1575,7 +1581,5 @@ void DocumentObjectItem::slotChangeStatusTip(const QString& tip)
this->setStatusTip(0, tip);
}
#include "moc_Tree.cpp"