summaryrefslogtreecommitdiffstats
path: root/lib/kofficecore/KoMainWindow.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2014-10-05 16:03:36 -0500
committerTimothy Pearson <[email protected]>2014-10-05 16:03:36 -0500
commita0f523a8b19360d875c4055398dc7191eda08f5d (patch)
tree3f554b5ce33c40ba1b9d4176aeef04414821bc45 /lib/kofficecore/KoMainWindow.cpp
parent76524e734a13c3d9b19e4b882e573c0924e32e61 (diff)
downloadkoffice-a0f523a8b19360d875c4055398dc7191eda08f5d.tar.gz
koffice-a0f523a8b19360d875c4055398dc7191eda08f5d.zip
Do not delete referenced MainWindow in document destructor
This resolves Bug 1729
Diffstat (limited to 'lib/kofficecore/KoMainWindow.cpp')
-rw-r--r--lib/kofficecore/KoMainWindow.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/kofficecore/KoMainWindow.cpp b/lib/kofficecore/KoMainWindow.cpp
index 18916b57..a2189c88 100644
--- a/lib/kofficecore/KoMainWindow.cpp
+++ b/lib/kofficecore/KoMainWindow.cpp
@@ -184,7 +184,7 @@ public:
};
KoMainWindow::KoMainWindow( TDEInstance *instance, const char* name )
- : KParts::MainWindow( name )
+ : KParts::MainWindow( 0, 0L, name )
{
setStandardToolBarMenuEnabled(true); // should there be a check for >= 3.1 ?
Q_ASSERT(instance);
@@ -310,13 +310,19 @@ KoMainWindow::KoMainWindow( TDEInstance *instance, const char* name )
KoMainWindow::~KoMainWindow()
{
+ if (!d) {
+ return;
+ }
+
// The doc and view might still exist (this is the case when closing the window)
- if (d->m_rootDoc)
+ if (d->m_rootDoc) {
d->m_rootDoc->removeShell(this);
+ }
if (d->m_docToOpen) {
d->m_docToOpen->removeShell(this);
delete d->m_docToOpen;
+ d->m_docToOpen=0L;
}
// safety first ;)
@@ -337,10 +343,13 @@ KoMainWindow::~KoMainWindow()
{
//kdDebug(30003) << "Destructor. No more views, deleting old doc " << d->m_rootDoc << endl;
delete d->m_rootDoc;
+ d->m_rootDoc=0L;
}
delete d->m_manager;
+ d->m_manager=0L;
delete d;
+ d=0L;
}
void KoMainWindow::setRootDocument( KoDocument *doc )