summaryrefslogtreecommitdiff
path: root/src/webchannel/signalhandler_p.h
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2015-02-04 19:12:12 +0100
committerMilian Wolff <milian.wolff@kdab.com>2015-02-04 19:12:12 +0100
commit801076803ce92d7bd646a58c792015c2b833d0c5 (patch)
treeb9bc16705a541cf402ee4614da7115135efb19d5 /src/webchannel/signalhandler_p.h
parent9d705911391c456813ce54a52f70aa2ccbc5b553 (diff)
parent358e5acba3154a8ab4b53b22797c2c1eae4707dc (diff)
downloadqtwebchannel-801076803ce92d7bd646a58c792015c2b833d0c5.tar.gz
Merge branch '5.4' into dev
This merge required extensive conflict handling because the bug fix in 5.4 to properly wrap and forward QObjects referenced by published objects' properties clashed with some feature additions in dev, namely the client separation logic. All unit test pass for me locally now again. Conflicts: .qmake.conf src/webchannel/qmetaobjectpublisher.cpp tests/auto/qml/tst_webchannel.qml Change-Id: If3d00e13b265c6ab9fb2c38023014f97f8e7779b
Diffstat (limited to 'src/webchannel/signalhandler_p.h')
-rw-r--r--src/webchannel/signalhandler_p.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/webchannel/signalhandler_p.h b/src/webchannel/signalhandler_p.h
index 2560cdb..03fbca9 100644
--- a/src/webchannel/signalhandler_p.h
+++ b/src/webchannel/signalhandler_p.h
@@ -84,6 +84,11 @@ public:
*/
void clear();
+ /**
+ * Fully remove and disconnect an object from handler
+ */
+ void remove(const QObject *object);
+
private:
/**
* Exctract the arguments of a signal call and pass them to the receiver.
@@ -252,15 +257,6 @@ int SignalHandler<Receiver>::qt_metacall(QMetaObject::Call call, int methodId, v
dispatch(object, methodId, args);
- if (methodId == s_destroyedSignalIndex) {
- // disconnect on QObject::destroyed
- ConnectionHash::iterator it = m_connectionsCounter.find(object);
- Q_ASSERT(it != m_connectionsCounter.end());
- foreach (const ConnectionPair &connection, *it) {
- QObject::disconnect(connection.first);
- }
- m_connectionsCounter.erase(it);
- }
return -1;
}
return methodId;
@@ -280,6 +276,17 @@ void SignalHandler<Receiver>::clear()
m_signalArgumentTypes[&QObject::staticMetaObject] = keep;
}
+template<class Receiver>
+void SignalHandler<Receiver>::remove(const QObject *object)
+{
+ Q_ASSERT(m_connectionsCounter.contains(object));
+ const SignalConnectionHash &connections = m_connectionsCounter.value(object);
+ foreach (const ConnectionPair &connection, connections) {
+ QObject::disconnect(connection.first);
+ }
+ m_connectionsCounter.remove(object);
+}
+
QT_END_NAMESPACE
#endif // SIGNALHANDLER_H