Gui: ignore recursive call of PropertyView::onTimer()

This commit is contained in:
wmayer
2022-10-20 23:00:50 +02:00
parent fba6a718eb
commit 9ba9599629
3 changed files with 11 additions and 0 deletions

View File

@@ -29,7 +29,9 @@
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Base/Console.h>
#include <Base/Parameter.h>
#include <Base/Tools.h>
#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()) {

View File

@@ -109,6 +109,7 @@ private:
Connection connectChangedDocument;
QTabWidget* tabs;
QTimer* timer;
bool updating = false;
};
namespace DockWnd {

View File

@@ -415,6 +415,7 @@ void PropertyModel::buildUp(const PropertyModel::PropertyList& props)
int first = static_cast<int>(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();