diff options
Diffstat (limited to 'src/corelib/tools/qsharedpointer.cpp')
-rw-r--r-- | src/corelib/tools/qsharedpointer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index e47e0fb960..385caa2e4b 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2020 Intel Corporation. +** Copyright (C) 2019 Klarälvdalens Datakonsult AB. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -1562,6 +1563,12 @@ void QtSharedPointer::internalSafetyCheckAdd(const void *d_ptr, const volatile v if (!kp) return; // end-game: the application is being destroyed already + if (!ptr) { + // nullptr is allowed to be tracked by more than one QSharedPointer, so we + // need something else to put in our tracking structures + ptr = d_ptr; + } + QMutexLocker lock(&kp->mutex); Q_ASSERT(!kp->dPointers.contains(d_ptr)); |