diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2012-08-16 16:49:38 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-28 21:18:17 +0200 |
commit | 20993adffdad15b636996d20a39c91a0abd397a8 (patch) | |
tree | 6934ca6628c1eac949285df09880586e1408d842 /src/corelib/tools/qsharedpointer_impl.h | |
parent | 0680627d7f7384559e04f7440f6becbf1417276f (diff) |
QSharedPointer: make QT_SHAREDPOINTER_TRACK_POINTERS work with QObjects
If setQObjectShared crashes because a QObject is tracked by two
different QSharedPointers, we lose the debug feature offered by #defining
QT_SHAREDPOINTER_TRACK_POINTERS, as the check done by this define
happens after the setQObjectShared call.
Therefore, move setQObjectShared after the internalSafetyCheckAdd call.
This is actually a noop change in 5.0, as setQObjectShared does nothing.
However it prevents a bug in case the Qt 4 behaviour is brought back
in some later version.
Change-Id: I71340d0f878828354537762d01c46d441efc918c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qsharedpointer_impl.h')
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index f5a94fe00b..2cb07ad2fe 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -387,10 +387,10 @@ public: // now initialize the data new (result.data()) T(); - result.d->setQObjectShared(result.value, true); # ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(result.d, result.value); # endif + result.d->setQObjectShared(result.value, true); return result; } @@ -425,10 +425,10 @@ private: # endif d = Private::create(ptr, deleter, actualDeleter); - d->setQObjectShared(ptr, true); #ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(d, ptr); #endif + d->setQObjectShared(ptr, true); } template <class X> |