diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-10-05 16:03:36 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-10-05 16:03:36 -0500 |
commit | a0f523a8b19360d875c4055398dc7191eda08f5d (patch) | |
tree | 3f554b5ce33c40ba1b9d4176aeef04414821bc45 /lib | |
parent | 76524e734a13c3d9b19e4b882e573c0924e32e61 (diff) | |
download | koffice-a0f523a8b19360d875c4055398dc7191eda08f5d.tar.gz koffice-a0f523a8b19360d875c4055398dc7191eda08f5d.zip |
Do not delete referenced MainWindow in document destructor
This resolves Bug 1729
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kofficecore/KoDocument.cpp | 6 | ||||
-rw-r--r-- | lib/kofficecore/KoMainWindow.cpp | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/kofficecore/KoDocument.cpp b/lib/kofficecore/KoDocument.cpp index e1422800..67e70ecc 100644 --- a/lib/kofficecore/KoDocument.cpp +++ b/lib/kofficecore/KoDocument.cpp @@ -269,6 +269,10 @@ KoDocument::KoDocument( TQWidget * parentWidget, const char *widgetName, TQObjec KoDocument::~KoDocument() { + if (!d) { + return; + } + d->m_autoSaveTimer.stop(); TQPtrListIterator<KoDocumentChild> childIt( d->m_children ); @@ -288,12 +292,12 @@ KoDocument::~KoDocument() d->m_children.setAutoDelete( true ); d->m_children.clear(); - d->m_shells.setAutoDelete( true ); d->m_shells.clear(); delete d->m_dcopObject; delete d->filterManager; delete d; + d=0L; s_documentList->removeRef(this); // last one? if(s_documentList->isEmpty()) { 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 ) |