Fix SignalSpy disconnect issue
authorCharles Yin <yinyunqiao@gmail.com>
Wed, 7 Mar 2012 13:12:26 +0000 (23:12 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 13 Mar 2012 01:02:49 +0000 (02:02 +0100)
Task-number:QTBUG-21083
Change-Id: Ic61472d886bf7c46eb37dc44b5e5ceb401917087
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/imports/testlib/SignalSpy.qml

index 8b74132..539cb17 100644 (file)
@@ -92,7 +92,9 @@ Item {
 
     function qtest_update() {
         if (qtest_prevTarget != null) {
-            qtest_prevTarget[qtest_prevSignalName].disconnect(spy, "qtest_activated")
+            var prevFunc = qtest_prevTarget[qtest_prevSignalName]
+            if (prevFunc)
+                prevFunc.disconnect(spy.qtest_activated)
             qtest_prevTarget = null
             qtest_prevSignalName = ""
         }