summaryrefslogtreecommitdiff
path: root/tests/auto/webchannel/tst_webchannel.cpp
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2017-04-20 12:05:11 +0200
committerMilian Wolff <milian.wolff@kdab.com>2017-06-26 13:25:40 +0000
commit64306392ce3a7751bfb58e1352b212ad5cba8aec (patch)
tree966c77986bf46dc0a402b3327e24f7803afefa37 /tests/auto/webchannel/tst_webchannel.cpp
parent18a53cef73eed59cddd7962d4e4aa8fbf7d3170a (diff)
downloadqtwebchannel-64306392ce3a7751bfb58e1352b212ad5cba8aec.tar.gz
Gracefully handle early deregistration of objects
When an object is deregistered before the signal handler got initializated, we asserted. Now, we check for this case and skip the signal handler removal when it wasn't set up yet. Change-Id: I1edb5fb4f1429e6c69c6c41baabd3d30a4b6fe10 Task-number: QTBUG-60250 Reviewed-by: Kai Dohmen <psykai1993@googlemail.com> Reviewed-by: Konstantin Tokarev <annulen@yandex.ru> (cherry picked from commit 446978af11ab886d734ca3972dcd73f847df9fbc)
Diffstat (limited to 'tests/auto/webchannel/tst_webchannel.cpp')
-rw-r--r--tests/auto/webchannel/tst_webchannel.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/webchannel/tst_webchannel.cpp b/tests/auto/webchannel/tst_webchannel.cpp
index 2ab820b..95a6160 100644
--- a/tests/auto/webchannel/tst_webchannel.cpp
+++ b/tests/auto/webchannel/tst_webchannel.cpp
@@ -317,6 +317,21 @@ void TestWebChannel::testDeregisterObjects()
emit testObject.sig1();
}
+void TestWebChannel::testDeregisterObjectAtStart()
+{
+ QWebChannel channel;
+ QVERIFY(channel.registeredObjects().isEmpty());
+
+ TestObject testObject;
+ testObject.setObjectName("myTestObject");
+
+ channel.registerObject(testObject.objectName(), &testObject);
+ QCOMPARE(channel.registeredObjects().size(), 1);
+
+ channel.deregisterObject(&testObject);
+ QVERIFY(channel.registeredObjects().isEmpty());
+}
+
void TestWebChannel::testInfoForObject()
{
TestObject obj;