Fix crash introduced by actualy freeing memory.

Reviewed-By: con
This commit is contained in:
dt
2009-06-05 11:16:09 +02:00
parent 6c14c86fab
commit 8161acac8b
2 changed files with 6 additions and 7 deletions

View File

@@ -385,8 +385,7 @@ QtVersion::QtVersion(const QString &name, const QString &path)
QtVersion::~QtVersion() QtVersion::~QtVersion()
{ {
delete m_toolChain;
m_toolChain = 0;
} }
QString QtVersion::name() const QString QtVersion::name() const
@@ -853,7 +852,7 @@ void QtVersion::updateQMakeCXX() const
ProjectExplorer::ToolChain *QtVersion::toolChain() const ProjectExplorer::ToolChain *QtVersion::toolChain() const
{ {
updateToolChain(); updateToolChain();
return m_toolChain; return m_toolChain.data();
} }
void QtVersion::updateToolChain() const void QtVersion::updateToolChain() const
@@ -893,11 +892,10 @@ void QtVersion::updateToolChain() const
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines."; qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
} }
if (ProjectExplorer::ToolChain::equals(m_test, m_toolChain)) { if (ProjectExplorer::ToolChain::equals(m_test, m_toolChain.data())) {
delete m_test; delete m_test;
} else { } else {
delete m_toolChain; m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(m_test);
m_toolChain = m_test;
} }
m_toolChainUpToDate = true; m_toolChainUpToDate = true;

View File

@@ -33,6 +33,7 @@
#include <projectexplorer/environment.h> #include <projectexplorer/environment.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <QtCore/QSharedPointer>
#include <QtCore/QHash> #include <QtCore/QHash>
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
@@ -154,7 +155,7 @@ private:
mutable QString m_qmakeCXX; mutable QString m_qmakeCXX;
mutable bool m_toolChainUpToDate; mutable bool m_toolChainUpToDate;
mutable ProjectExplorer::ToolChain *m_toolChain; mutable QSharedPointer<ProjectExplorer::ToolChain> m_toolChain;
}; };
class QtVersionManager : public QObject class QtVersionManager : public QObject