summaryrefslogtreecommitdiffstats
path: root/lib/kofficecore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kofficecore')
-rw-r--r--lib/kofficecore/KoDocument.cpp6
-rw-r--r--lib/kofficecore/KoMainWindow.cpp13
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 )