diff options
author | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-05-21 07:31:51 (GMT) |
---|---|---|
committer | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-05-21 07:31:51 (GMT) |
commit | 47cbde8e5fbb7f0c4dc197c2ef241f5ba9fe2743 (patch) | |
tree | e8518206ec161750de9722aee17eb82805cca061 /src/corelib/kernel/qobject.cpp | |
parent | 0987e68043e174a2a033b58d065c6069c0cf8a1a (diff) | |
parent | a064fe66f5256c7ded6f3df87f503aa0fb8e341b (diff) | |
download | Qt-47cbde8e5fbb7f0c4dc197c2ef241f5ba9fe2743.zip Qt-47cbde8e5fbb7f0c4dc197c2ef241f5ba9fe2743.tar.gz Qt-47cbde8e5fbb7f0c4dc197c2ef241f5ba9fe2743.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index f5d3f78..6ea2d9f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -345,18 +345,6 @@ void QObjectPrivate::derefSender(QObject *sender, int signal) // Q_ASSERT_X(false, "QObjectPrivate::derefSender", "sender not found"); } -void QObjectPrivate::removeSender(QObject *sender, int signal) -{ - for (int i = 0; i < senders.count(); ++i) { - Sender &s = senders[i]; - if (s.sender == sender && s.signal == signal) { - senders.removeAt(i); - return; - } - } - // Q_ASSERT_X(false, "QObjectPrivate::removeSender", "sender not found"); -} - QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver, Sender *sender) { @@ -790,7 +778,7 @@ QObject::~QObject() bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); c = &connectionList[i]; if (c->receiver) - c->receiver->d_func()->removeSender(this, signal); + c->receiver->d_func()->derefSender(this, signal); if (needToUnlock) m->unlock(); @@ -811,18 +799,22 @@ QObject::~QObject() } // disconnect all senders - for (int i = 0; i < d->senders.count(); ++i) { + for (int i = 0; i < d->senders.count(); ) { QObjectPrivate::Sender *s = &d->senders[i]; - if (!s->sender) - continue; QMutex *m = &s->sender->d_func()->threadData->mutex; bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); - s = &d->senders[i]; - if (s->sender) - s->sender->d_func()->removeReceiver(s->signal, this); + if (m < locker.mutex()) { + if (i >= d->senders.count() || s != &d->senders[i]) { + if (needToUnlock) + m->unlock(); + continue; + } + } + s->sender->d_func()->removeReceiver(s->signal, this); if (needToUnlock) m->unlock(); + ++i; } d->senders.clear(); |