diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-12 09:03:49 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-12 09:12:36 (GMT) |
commit | 171d92dc8b800b24d28c7b4abf34d6961763bbf4 (patch) | |
tree | bcf2ce2ebf6546faa5cc2dc69e01687adb82f947 /src | |
parent | c8563ec79f01ec54a03bb2fdbba11a73a01370f7 (diff) | |
download | Qt-171d92dc8b800b24d28c7b4abf34d6961763bbf4.zip Qt-171d92dc8b800b24d28c7b4abf34d6961763bbf4.tar.gz Qt-171d92dc8b800b24d28c7b4abf34d6961763bbf4.tar.bz2 |
Autotest: make sure we can't create QWeakPointer from a QObject in destruction.
This test only works in debug mode
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qsharedpointer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index f793f26..e3e1db6 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -977,6 +977,8 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge { Q_ASSERT(obj); QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj)); + Q_ASSERT_X(!d->wasDeleted, "QWeakPointer", "Detected QWeakPointer creation in a QObject being deleted"); + ExternalRefCountData *that = d->sharedRefcount; if (that) { that->weakref.ref(); |