diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index fa1ebf669c..9032498467 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -29,7 +29,9 @@ #include #include +#include #include +#include #include "PropertyView.h" #include "Application.h" @@ -333,6 +335,13 @@ void PropertyView::onSelectionChanged(const SelectionChanges& msg) void PropertyView::onTimer() { + // See https://forum.freecadweb.org/viewtopic.php?f=8&t=72526 + if (this->updating) { + Base::Console().Log("Ignore recursive call of PropertyView::onTimer()\n"); + return; + } + Base::StateLocker guard(this->updating); + timer->stop(); if(!this->isSelectionAttached()) { diff --git a/src/Gui/PropertyView.h b/src/Gui/PropertyView.h index 7126700335..a058fcd04e 100644 --- a/src/Gui/PropertyView.h +++ b/src/Gui/PropertyView.h @@ -109,6 +109,7 @@ private: Connection connectChangedDocument; QTabWidget* tabs; QTimer* timer; + bool updating = false; }; namespace DockWnd { diff --git a/src/Gui/propertyeditor/PropertyModel.cpp b/src/Gui/propertyeditor/PropertyModel.cpp index 8b50ca099b..0ff4e78651 100644 --- a/src/Gui/propertyeditor/PropertyModel.cpp +++ b/src/Gui/propertyeditor/PropertyModel.cpp @@ -415,6 +415,7 @@ void PropertyModel::buildUp(const PropertyModel::PropertyList& props) int first = static_cast(groupInfo.children.size()); if (last > first) { QModelIndex midx = this->index(groupInfo.groupItem->_row, 0, QModelIndex()); + // This can trigger a recursive call of PropertyView::onTimer() beginRemoveRows(midx, first, last - 1); groupInfo.groupItem->removeChildren(first, last - 1); endRemoveRows();