summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsharedpointer/nontracked.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-01-03 15:17:21 -0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-04 17:30:19 +0100
commita094bf5a893c3cccffff10c1420bfbe3a3c02a7c (patch)
treec4c6d05db0103b124da7650f1df8b10fa5ab0a4f /tests/auto/corelib/tools/qsharedpointer/nontracked.h
parentbf5e7fb2652669599a508e049b46ebd5cd3206e5 (diff)
Don't increase the reference count if dynamic_cast failed
If the dynamic_cast failed in QSharedPointer::dynamicCast or qSharedPointerDynamicCast, we should avoid creating the QSharedPointer that shares the weak and strong reference counts. In Qt 5, this does not imply a leak since the original pointer is stored internally for deletion. In Qt 4 it implies a leak under certain circumstances, which this change fixes. Task-number: QTBUG-28924 Change-Id: Id2de140de4cf676461e14b201ad250c53666b79d Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/tools/qsharedpointer/nontracked.h')
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/nontracked.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qsharedpointer/nontracked.h b/tests/auto/corelib/tools/qsharedpointer/nontracked.h
new file mode 100644
index 0000000000..501ec2b73a
--- /dev/null
+++ b/tests/auto/corelib/tools/qsharedpointer/nontracked.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Intel Corporation.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef NONTRACKED_H
+#define NONTRACKED_H
+
+namespace NonTracked {
+void dynamicCastFailureNoLeak();
+}
+
+#endif // NONTRACKED_H