Fix segfault in autotest
authorKai Koehne <kai.koehne@digia.com>
Tue, 8 Oct 2013 08:59:28 +0000 (10:59 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 16 Oct 2013 06:33:52 +0000 (08:33 +0200)
Do not re-declare variable in local scope!

Change-Id: I4f66081603ce86d78965ac12368bda66d86ff0c4
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp

index 4cf8fa6..b6fab53 100644 (file)
@@ -313,7 +313,7 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
     m_process->start(QStringList() << arguments);
     QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'.");
 
-    QQmlDebugConnection *m_connection = new QQmlDebugConnection();
+    m_connection = new QQmlDebugConnection();
     m_client = new QQmlProfilerClient(m_connection);
 
     const int port = m_process->debugPort();
@@ -327,8 +327,11 @@ void tst_QQmlProfilerService::cleanup()
         qDebug() << "Application Output:" << m_process->output();
     }
     delete m_process;
-    delete m_connection;
+    m_process = 0;
     delete m_client;
+    m_client = 0;
+    delete m_connection;
+    m_connection = 0;
 }
 
 void tst_QQmlProfilerService::blockingConnectWithTraceEnabled()