Skip to content

Commit

Permalink
calling close() causes the MDI view to get deleted as soon as possibl…
Browse files Browse the repository at this point in the history
…e while deleteLater() waits until the GUI is responsive
  • Loading branch information
wwmayer committed Jul 17, 2017
1 parent 44fba58 commit b36686e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Gui/Document.cpp
Expand Up @@ -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"),
Expand Down
11 changes: 7 additions & 4 deletions src/Gui/MDIView.cpp
Expand Up @@ -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<QMdiSubWindow*>(parent))
parent->deleteLater();
else
this->deleteLater();
if (qobject_cast<QMdiSubWindow*>(parent)) {
// https://forum.freecadweb.org/viewtopic.php?f=22&t=23070
parent->close();
}
else {
this->close();
}

// detach from document
if (_pcDocument)
Expand Down

0 comments on commit b36686e

Please sign in to comment.