From ddb17b23b06dec4d2cba33079cc90f38826bea51 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 21 Aug 2019 09:52:16 +0800 Subject: [PATCH] Gui: fix property editor crash on recompute The actual cause of crash in previous commit 80f70ff6 is Document::recompute() allows aborting using Base::Sequence, which uses QApplication::processEvent() to catch 'ESC' key press. This local event loop causes premature deletion of the editor widget. This patch moves handling of closeEditor before calling recompute(). --- src/Gui/propertyeditor/PropertyEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 6daf4f734a..264c553e11 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -233,6 +233,8 @@ void PropertyEditor::onItemActivated ( const QModelIndex & index ) void PropertyEditor::closeEditor (QWidget * editor, QAbstractItemDelegate::EndEditHint hint) { + QTreeView::closeEditor(editor, hint); + if (autoupdate) { App::Document* doc = App::GetApplication().getActiveDocument(); if (doc) { @@ -249,8 +251,6 @@ void PropertyEditor::closeEditor (QWidget * editor, QAbstractItemDelegate::EndEd QModelIndex indexSaved = currentIndex(); FC_LOG("index saved " << indexSaved.row() << ", " << indexSaved.column()); - QTreeView::closeEditor(editor, hint); - QModelIndex lastIndex; while(this->state()!=EditingState) { QModelIndex index;