From b36686e5867803beda8fc1539373eb1c6f20a61b Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 17 Jul 2017 11:11:58 +0200 Subject: [PATCH] calling close() causes the MDI view to get deleted as soon as possible while deleteLater() waits until the GUI is responsive --- src/Gui/Document.cpp | 2 ++ src/Gui/MDIView.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index dbee2e6e24d1..a8869dfe6aea 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -1204,6 +1204,8 @@ bool Document::isLastView(void) */ bool Document::canClose () { + if (d->_isClosing) + return true; if (!getDocument()->isClosable()) { QMessageBox::warning(getActiveView(), QObject::tr("Document not closable"), diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index c069717035ea..6bf2aef74a48 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -92,10 +92,13 @@ void MDIView::deleteSelf() // #0001023: Crash when quitting after using Windows > Tile // Use deleteLater() instead of delete operator. QWidget* parent = this->parentWidget(); - if (qobject_cast(parent)) - parent->deleteLater(); - else - this->deleteLater(); + if (qobject_cast(parent)) { + // https://forum.freecadweb.org/viewtopic.php?f=22&t=23070 + parent->close(); + } + else { + this->close(); + } // detach from document if (_pcDocument)