diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-04-19 12:24:25 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-20 00:32:53 +0200 |
commit | 7e9f7080b764524d2a7c7a410a4cebed22f3b16d (patch) | |
tree | ee233191a49b95161a0fd2eca723ec6312d81415 | |
parent | 5533cc9953258daf6f83038432753069a37a80d3 (diff) |
Minor QObject::receivers() optimization.
Don't lock if there are no receivers.
Change-Id: I922fad10436adeb27aa4f193cc0dcbaa3f0c0f1e
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e35da8085e..a633f503a7 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2190,6 +2190,9 @@ int QObject::receivers(const char *signal) const metaObject()->indexOfMethod(signal)); } + if (!d->isSignalConnected(signal_index)) + return receivers; + QMutexLocker locker(signalSlotLock(this)); if (d->connectionLists) { if (signal_index < d->connectionLists->count()) { |