summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2009-08-10 13:18:56 (GMT)
committermread <qt-info@nokia.com>2009-08-10 13:18:56 (GMT)
commit34dd8163f4fcd16be5677fc94ce960cc464991d5 (patch)
treef871fef42b4f337a98bce77ad307efe079b7dc5f /src/corelib/kernel/qobject.cpp
parent0dfca6e13a7ad3cce38d5509d446f76eb496f398 (diff)
parent70e098d965318651acb725374b73e026f2946b76 (diff)
downloadQt-34dd8163f4fcd16be5677fc94ce960cc464991d5.zip
Qt-34dd8163f4fcd16be5677fc94ce960cc464991d5.tar.gz
Qt-34dd8163f4fcd16be5677fc94ce960cc464991d5.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.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index e6947a0..0f8548a 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -56,6 +56,7 @@
#include <qvarlengtharray.h>
#include <qset.h>
#include <qsemaphore.h>
+#include <qsharedpointer.h>
#include <private/qorderedmutexlocker_p.h>
#include <private/qmutexpool_p.h>
@@ -794,6 +795,18 @@ QObject::~QObject()
QObjectPrivate::clearGuards(this);
}
+ if (d->sharedRefcount) {
+ if (d->sharedRefcount->strongref > 0) {
+ qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash.");
+ // but continue deleting, it's too late to stop anyway
+ }
+
+ // indicate to all QWeakPointers that this QObject has now been deleted
+ d->sharedRefcount->strongref = 0;
+ if (!d->sharedRefcount->weakref.deref())
+ delete d->sharedRefcount;
+ }
+
QT_TRY {
emit destroyed(this);
if (d->declarativeData)
@@ -814,6 +827,7 @@ QObject::~QObject()
#endif
}
+
{
QMutex *signalSlotMutex = 0;
QT_TRY {
@@ -878,9 +892,9 @@ QObject::~QObject()
if (senderLists)
senderLists->dirty = true;
+ node = node->next;
if (needToUnlock)
m->unlock();
- node = node->next;
}
}