summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsharedpointer/qsharedpointer.pro
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-07-31 20:10:49 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-03 12:14:57 (GMT)
commit1c5cf2e3d6f091593aec237bbb527cb8cdb964c4 (patch)
tree3e2e7979636f7a744a5101930c0f23669cdebb7e /tests/auto/qsharedpointer/qsharedpointer.pro
parent7e0b201285c712a3c98c848033bbd8e5ab75a590 (diff)
downloadQt-1c5cf2e3d6f091593aec237bbb527cb8cdb964c4.zip
Qt-1c5cf2e3d6f091593aec237bbb527cb8cdb964c4.tar.gz
Qt-1c5cf2e3d6f091593aec237bbb527cb8cdb964c4.tar.bz2
Change the pointer-tracking code to work everywhere.
Currently, if you create a QSharedPointer in code with pointer-tracking, you must ensure it gets deleted in code with pointer-tracking, otherwise the internal safety tracker will be "leaking" objects. The pointers would never get removed. And if any new pointer happened to have the same pointer address (which happens quite often), the tracker code would promptly abort the application. With this change, the untracking of the pointer is scheduled by the same code that creates the tracking. This is done by "abusing" the custom deleter code: - for the QSharedPointer that used ExternalRefCountWithDestroyFn already, we intercept the call to the destroy function and call the untracking function - for a normal QSharedPointer, we use the "normalDeleter" function as custom deleter and chain up above Note: the autotest only *really* works in release mode. Otherwise functions don't get inlined and do get merged by the linker. Reviewed-By: Bradley T. Hughes
Diffstat (limited to 'tests/auto/qsharedpointer/qsharedpointer.pro')
-rw-r--r--tests/auto/qsharedpointer/qsharedpointer.pro10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/qsharedpointer/qsharedpointer.pro
index 30c81cb..1759323 100644
--- a/tests/auto/qsharedpointer/qsharedpointer.pro
+++ b/tests/auto/qsharedpointer/qsharedpointer.pro
@@ -1,8 +1,14 @@
load(qttest_p4)
+
SOURCES += tst_qsharedpointer.cpp \
forwarddeclaration.cpp \
- forwarddeclared.cpp
+ forwarddeclared.cpp \
+ wrapper.cpp
+
+HEADERS += forwarddeclared.h \
+ wrapper.h
+
QT = core
DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
include(externaltests.pri)
-HEADERS += forwarddeclared.h