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-05-15 14:37:49 +0000
commit446978af11ab886d734ca3972dcd73f847df9fbc (patch)
tree3d002cb799aa73aad0c93929b083903c66a48e7c /tests/auto/webchannel/tst_webchannel.cpp
parent36a42a2ebd3198654a29afe7f6bb450849c745ea (diff)
downloadqtwebchannel-446978af11ab886d734ca3972dcd73f847df9fbc.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: I7abad204cbab72be7729d42f58ce63babd2310d8 Task-number: QTBUG-60250 Reviewed-by: Kai Dohmen <psykai1993@googlemail.com> Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
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 24d473f..2e80477 100644
--- a/tests/auto/webchannel/tst_webchannel.cpp
+++ b/tests/auto/webchannel/tst_webchannel.cpp
@@ -312,6 +312,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;