QSharedPointer: make QT_SHAREDPOINTER_TRACK_POINTERS work with QObjects
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Thu, 16 Aug 2012 15:49:38 +0000 (16:49 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 28 Aug 2012 19:18:17 +0000 (21:18 +0200)
commit20993adffdad15b636996d20a39c91a0abd397a8
tree6934ca6628c1eac949285df09880586e1408d842
parent0680627d7f7384559e04f7440f6becbf1417276f
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>
src/corelib/tools/qsharedpointer_impl.h
tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp