summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h6
-rw-r--r--src/corelib/tools/tools.pri2
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp3
3 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 928805a..0471a1b 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -48,6 +48,8 @@
#pragma qt_sync_stop_processing
#endif
+#include <QtCore/qatomic.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -138,14 +140,14 @@ namespace QtSharedPointer {
inline void internalConstruct(T *ptr)
{
-#ifndef QT_NO_DEBUG
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
if (ptr) internalSafetyCheckAdd(ptr);
#endif
value = ptr;
}
inline void internalDestroy()
{
-#ifndef QT_NO_DEBUG
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
if (value) internalSafetyCheckRemove(value);
#endif
}
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index e5bf7e4..b70c7df 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -26,6 +26,8 @@ HEADERS += \
tools/qregexp.h \
tools/qringbuffer_p.h \
tools/qshareddata.h \
+ tools/qsharedpointer.h \
+ tools/qsharedpointer_impl.h \
tools/qset.h \
tools/qsize.h \
tools/qstack.h \
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 795ce76..a11164f 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-
+#define QT_SHAREDPOINTER_TRACK_POINTERS
#include "qsharedpointer.h"
#include "externaltests.h"
#include <QtTest/QtTest>
@@ -995,6 +995,7 @@ void tst_QSharedPointer::invalidConstructs()
test.setDebugMode(true);
test.setQtModules(QTest::QExternalTest::QtCore);
test.setProgramHeader(
+ "#define QT_SHAREDPOINTER_TRACK_POINTERS\n"
"#include <QtCore/qsharedpointer.h>\n"
"\n"
"struct Data { int i; };\n"