aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2012-09-28 11:28:23 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-10 11:21:15 +0200
commitb1c6e095404ccb7788e6b12fff692c71f4900815 (patch)
treec9e25e2e53a5b0d7c10ac0e6cef1e8fae71261d0 /src
parent581c57125368eb6ef0b853e037649cf0c1a8bc80 (diff)
Fix QObject::receivers() within connectNotify()
The receiver count needs to be correct in connectNotify() to be compatible with ordinary connections. Fix this and add test. Change-Id: Icff0486dac49876b8c5d8836a85cff9284368a52 Reviewed-by: Alan Alpert <416365416c@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlnotifier_p.h8
1 files changed, 6 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;