QmlProfiler: fix dangling pointer in Engine

Task-number: QTCREATORBUG-9391

Change-Id: Ib2ea66bd5694046577a0b5a0e2f611f3ffba0238
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Christiaan Janssen
2013-06-03 13:47:04 +02:00
committed by Kai Koehne
parent d97a7f4067
commit 25dd94808d

View File

@@ -61,7 +61,7 @@ class QmlProfilerEngine::QmlProfilerEnginePrivate
{ {
public: public:
QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {} QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
~QmlProfilerEnginePrivate() { delete m_runner; } ~QmlProfilerEnginePrivate() { m_runner->disconnect(); delete m_runner; }
bool attach(const QString &address, uint port); bool attach(const QString &address, uint port);
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration, static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
@@ -153,6 +153,7 @@ bool QmlProfilerEngine::start()
QTC_ASSERT(d->m_profilerState, return false); QTC_ASSERT(d->m_profilerState, return false);
if (d->m_runner) { if (d->m_runner) {
d->m_runner->disconnect();
delete d->m_runner; delete d->m_runner;
d->m_runner = 0; d->m_runner = 0;
} }
@@ -364,6 +365,7 @@ void QmlProfilerEngine::profilerStateChanged()
// (a new one will be created at start) // (a new one will be created at start)
d->m_noDebugOutputTimer.stop(); d->m_noDebugOutputTimer.stop();
if (d->m_runner) { if (d->m_runner) {
d->m_runner->disconnect();
delete d->m_runner; delete d->m_runner;
d->m_runner = 0; d->m_runner = 0;
} }