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)