diff options
author | John Brooks <special@dereferenced.net> | 2010-08-12 08:14:25 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-08-12 08:14:25 (GMT) |
commit | cf13b06e88e68ca966d6327c0e12cc7b89d616fc (patch) | |
tree | e3065f95b29cfbcf329df638ef59f8656bc7a0d2 /src/corelib/kernel | |
parent | ac45e864d49eb114747611357704324875086e5e (diff) | |
download | Qt-cf13b06e88e68ca966d6327c0e12cc7b89d616fc.zip Qt-cf13b06e88e68ca966d6327c0e12cc7b89d616fc.tar.gz Qt-cf13b06e88e68ca966d6327c0e12cc7b89d616fc.tar.bz2 |
Cleanup the connection list logic in QObject::sender
Merge-request: 2433
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 143dbff..9ce111d 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2298,13 +2298,12 @@ QObject *QObject::sender() const if (!d->currentSender) return 0; - // Return 0 if d->currentSender isn't in d->senders - bool found = false; - for (QObjectPrivate::Connection *c = d->senders; c && !found; c = c->next) - found = (c->sender == d->currentSender->sender); - if (!found) - return 0; - return d->currentSender->sender; + for (QObjectPrivate::Connection *c = d->senders; c; c = c->next) { + if (c->sender == d->currentSender->sender) + return d->currentSender->sender; + } + + return 0; } /*! |