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().
This commit is contained in:
Zheng, Lei
2019-08-21 09:52:16 +08:00
committed by wmayer
parent 6aec9ffed7
commit 27a2ebed71

View File

@@ -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;