From 72c74b7d5aaaf24f084ed81fcf58f59387983515 Mon Sep 17 00:00:00 2001
From: Leandro Melo <leandro.melo@nokia.com>
Date: Tue, 8 Jun 2010 13:55:50 +0200
Subject: [PATCH] Bug fix: Late crash when closing Creator while building
 debugging helper (QTCREATORBUG-1576).

Reviewed-by: hjk
---
 src/plugins/coreplugin/coreimpl.cpp             | 5 +++++
 src/plugins/coreplugin/coreimpl.h               | 2 +-
 src/plugins/projectexplorer/debugginghelper.cpp | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp
index c6da6362d44..d072e8df091 100644
--- a/src/plugins/coreplugin/coreimpl.cpp
+++ b/src/plugins/coreplugin/coreimpl.cpp
@@ -61,6 +61,11 @@ CoreImpl::CoreImpl(MainWindow *mainwindow)
     m_mainwindow = mainwindow;
 }
 
+CoreImpl::~CoreImpl()
+{
+    m_instance = 0;
+}
+
 QStringList CoreImpl::showNewItemDialog(const QString &title,
                                         const QList<IWizard *> &wizards,
                                         const QString &defaultLocation)
diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h
index d04defd3181..50a8a673fbd 100644
--- a/src/plugins/coreplugin/coreimpl.h
+++ b/src/plugins/coreplugin/coreimpl.h
@@ -42,7 +42,7 @@ class CoreImpl : public ICore
 
 public:
     CoreImpl(MainWindow *mainwindow);
-    ~CoreImpl() {}
+    ~CoreImpl();
 
     QStringList showNewItemDialog(const QString &title,
                                   const QList<IWizard *> &wizards,
diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp
index 495996e4506..9c091557c01 100644
--- a/src/plugins/projectexplorer/debugginghelper.cpp
+++ b/src/plugins/projectexplorer/debugginghelper.cpp
@@ -113,6 +113,8 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocationsByInstallData
 
 QString DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(const QString &qtInstallData)
 {
+    if (!Core::ICore::instance())
+        return QString();
     const QString dumperSourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/gdbmacros/");
     QDateTime lastModified = QFileInfo(dumperSourcePath + "gdbmacros.cpp").lastModified();
     // We pretend that the lastmodified of gdbmacros.cpp is 5 minutes before what the file system says
-- 
GitLab