From 267c8ad046d45c63a323eac32e00c3beeaddf0fd Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 6 Jul 2013 17:21:35 +0200 Subject: [PATCH] 0001023: Crash when quitting after using Windows > Tile --- src/Gui/MDIView.cpp | 8 ++++++-- src/Gui/View3DInventor.cpp | 6 ++++++ src/Gui/View3DInventor.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index 895d4ec4e..80646a14d 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -76,13 +76,17 @@ void MDIView::deleteSelf() { // When using QMdiArea make sure to remove the QMdiSubWindow // this view is associated with. + // + // #0001023: Crash when quitting after using Windows > Tile + // Use deleteLater() instead of delete operator. #if !defined (NO_USE_QT_MDI_AREA) QWidget* parent = this->parentWidget(); if (qobject_cast(parent)) - delete parent; + parent->deleteLater(); else #endif - delete this; + this->deleteLater(); + _pcDocument = 0; } void MDIView::setOverrideCursor(const QCursor& c) diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 9528ef143..3fca6cf0e 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -179,6 +179,12 @@ View3DInventor::~View3DInventor() delete _viewer; } +void View3DInventor::deleteSelf() +{ + _viewer->setDocument(0); + MDIView::deleteSelf(); +} + PyObject *View3DInventor::getPyObject(void) { if (!_viewerPy) diff --git a/src/Gui/View3DInventor.h b/src/Gui/View3DInventor.h index 94cd990e8..f955c0cc6 100644 --- a/src/Gui/View3DInventor.h +++ b/src/Gui/View3DInventor.h @@ -73,6 +73,7 @@ public: /// Mesage handler virtual bool onMsg(const char* pMsg, const char** ppReturn); virtual bool onHasMsg(const char* pMsg) const; + virtual void deleteSelf(); /// Observer message from the ParameterGrp virtual void OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::MessageType Reason); /// get called when the document is updated