summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-05-21 07:31:51 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-05-21 07:31:51 (GMT)
commit47cbde8e5fbb7f0c4dc197c2ef241f5ba9fe2743 (patch)
treee8518206ec161750de9722aee17eb82805cca061 /src/corelib/kernel/qobject.cpp
parent0987e68043e174a2a033b58d065c6069c0cf8a1a (diff)
parenta064fe66f5256c7ded6f3df87f503aa0fb8e341b (diff)
downloadQt-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.cpp30
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();