diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-25 16:08:30 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-25 16:08:30 (GMT) |
commit | 5dcf29ec09bd9741bb48449a07831987a75bf42a (patch) | |
tree | cd0c3ecdc33bb93075e3a7d9b2593382e2768948 /src/corelib | |
parent | 9b40f0275043566a6e1f1471e1f608dd66929b81 (diff) | |
parent | 2ab5d8db650118312bfe9b1e60c4ac60229b229f (diff) | |
download | Qt-5dcf29ec09bd9741bb48449a07831987a75bf42a.zip Qt-5dcf29ec09bd9741bb48449a07831987a75bf42a.tar.gz Qt-5dcf29ec09bd9741bb48449a07831987a75bf42a.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qsharedpointer.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index d8a9923..c3a989e 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -842,15 +842,19 @@ QT_BEGIN_NAMESPACE */ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) { - QMutexLocker lock(&knownPointers()->mutex); + KnownPointers *const kp = knownPointers(); + if (!kp) + return; // end-game: the application is being destroyed already + + QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); - if (knownPointers()->values.contains(actual)) { + 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); } - knownPointers()->values.insert(actual, saveBacktrace()); + kp->values.insert(actual, saveBacktrace()); } /*! @@ -858,9 +862,13 @@ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) */ void QtSharedPointer::internalSafetyCheckRemove(const volatile void *ptr) { - QMutexLocker lock(&knownPointers()->mutex); + KnownPointers *const kp = knownPointers(); + if (!kp) + return; // end-game: the application is being destroyed already + + QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); - knownPointers()->values.remove(actual); + kp->values.remove(actual); } QT_END_NAMESPACE |