summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-18 14:31:07 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-18 14:31:07 (GMT)
commitf3988241faa59596c1702b31e7bec9538f33ee79 (patch)
tree39cc06b8455545cd1fd754c44838afcc3a0bdaac /src/corelib/kernel/qobject.cpp
parent7e4d4474d10cb17047d95e3a4820388468c74507 (diff)
parent5c25207628fbcc94e92b129ac7660af14613ad85 (diff)
downloadQt-f3988241faa59596c1702b31e7bec9538f33ee79.zip
Qt-f3988241faa59596c1702b31e7bec9538f33ee79.tar.gz
Qt-f3988241faa59596c1702b31e7bec9538f33ee79.tar.bz2
Merge commit 'origin/4.5'
Conflicts: src/corelib/kernel/qobject.cpp src/corelib/kernel/qobject_p.h src/network/access/qhttpnetworkconnection.cpp
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 287ac30..9f803fa 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -752,14 +752,18 @@ QObject::~QObject()
}
// disconnect all senders
- for (int i = 0; i < d->senders.count(); ++i) {
+ for (int i = 0; i < d->senders.count(); ) {
QObjectPrivate::Connection *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 (m < locker.mutex()) {
+ if (i >= d->senders.count() || s != d->senders[i]) {
+ if (needToUnlock)
+ m->unlock();
+ continue;
+ }
+ }
s->receiver = 0;
if (s->sender) {
QObjectConnectionListVector *senderLists = s->sender->d_func()->connectionLists;
@@ -769,6 +773,7 @@ QObject::~QObject()
if (needToUnlock)
m->unlock();
+ ++i;
}
d->senders.clear();