From 96fbc28c9b4e8e97eec43b99fc18ad29c269bd25 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 27 Jul 2009 21:16:34 +0200 Subject: Disable the pointer tracking feature in Qt 4.5. The functionality is broken, since pointers can be released by a QSharedPointer tracking a pointer of different type, which would leave behind pointers in the hash. The fix requires Qt 4.6 because of a new symbol being added. --- src/corelib/tools/qsharedpointer.cpp | 28 +++++----------------------- src/corelib/tools/qsharedpointer_impl.h | 6 ------ 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index ba62ce1..c9dccd3 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -833,42 +833,24 @@ namespace { }; } -Q_GLOBAL_STATIC(KnownPointers, knownPointers) +//Q_GLOBAL_STATIC(KnownPointers, knownPointers) QT_BEGIN_NAMESPACE /*! \internal */ -void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) +void QtSharedPointer::internalSafetyCheckAdd(const volatile void *) { - KnownPointers *const kp = knownPointers(); - if (!kp) - return; // end-game: the application is being destroyed already - - QMutexLocker lock(&kp->mutex); - void *actual = const_cast(ptr); - if (kp->values.contains(actual)) { - printBacktrace(knownPointers()->values.value(actual)); - qFatal("QSharedPointerData: internal self-check failed: pointer %p was already tracked " - "by another QSharedPointerData object", actual); - } - - kp->values.insert(actual, saveBacktrace()); + // functionality is broken + // fix requires Qt 4.6 } /*! \internal */ -void QtSharedPointer::internalSafetyCheckRemove(const volatile void *ptr) +void QtSharedPointer::internalSafetyCheckRemove(const volatile void *) { - KnownPointers *const kp = knownPointers(); - if (!kp) - return; // end-game: the application is being destroyed already - - QMutexLocker lock(&kp->mutex); - void *actual = const_cast(ptr); - kp->values.remove(actual); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 0471a1b..7aaed22 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -140,16 +140,10 @@ namespace QtSharedPointer { inline void internalConstruct(T *ptr) { -#ifdef QT_SHAREDPOINTER_TRACK_POINTERS - if (ptr) internalSafetyCheckAdd(ptr); -#endif value = ptr; } inline void internalDestroy() { -#ifdef QT_SHAREDPOINTER_TRACK_POINTERS - if (value) internalSafetyCheckRemove(value); -#endif } #if defined(Q_NO_TEMPLATE_FRIENDS) -- cgit v0.12