diff options
-rw-r--r-- | src/qml/qml/qqmlnotifier_p.h | 8 | ||||
-rw-r--r-- | tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h index 4bf8015a49..e3c2271ac7 100644 --- a/src/qml/qml/qqmlnotifier_p.h +++ b/src/qml/qml/qqmlnotifier_p.h @@ -189,13 +189,17 @@ void QQmlNotifierEndpoint::connect(QQmlNotifier *notifier) void QQmlNotifierEndpoint::disconnect() { + // Remove from notifier chain before calling disconnectNotify(), so that that + // QObject::receivers() returns the correct value in there + if (next) next->prev = prev; + if (prev) *prev = next; + if (sourceSignal != -1) { QObject * const obj = senderAsObject(); QObjectPrivate * const priv = QObjectPrivate::get(obj); priv->disconnectNotify(QMetaObjectPrivate::signal(obj->metaObject(), sourceSignal)); } - if (next) next->prev = prev; - if (prev) *prev = next; + if (isNotifying()) *((intptr_t *)(senderPtr & ~0x1)) = 0; next = 0; prev = 0; diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index fdfa211126..ae37b6a4fb 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -120,6 +120,7 @@ protected: if (signal.name() == "scriptBindingPropChanged") scriptBindingPropConnections++; if (signal.name() == "boundSignal") boundSignalConnections++; if (signal.name() == "unusedSignal") unusedSignalConnections++; + verifyReceiverCount(); //qDebug() << Q_FUNC_INFO << this << signal.name(); } @@ -133,6 +134,7 @@ protected: if (signal.name() == "scriptBindingPropChanged") scriptBindingPropConnections--; if (signal.name() == "boundSignal") boundSignalConnections--; if (signal.name() == "unusedSignal") unusedSignalConnections--; + verifyReceiverCount(); //qDebug() << Q_FUNC_INFO << this << signal.methodSignature(); } |