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>
This commit is contained in:
Michael Brasser 2012-04-19 12:24:25 +10:00 committed by Qt by Nokia
parent 5533cc9953
commit 7e9f7080b7

View File

@ -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()) {