diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-10-19 08:42:14 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-11-09 15:07:03 +0200 |
commit | 24a0303b9ed7d48c75c4567b93b327b731b2de3b (patch) | |
tree | 450d3a657a54bfdabb6839e1d9243d04ade8aec3 | |
parent | 4ea99db8f399cfda63e94a0e82bed4660f20d260 (diff) |
Doc: mention that disconnecting all signals can be dangerous
Task-number: QTBUG-83387
Change-Id: I55c0a267e5490ba0226fd6858c18fd88cc3b8d59
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r-- | src/corelib/doc/src/includes/qobject.qdocinc | 34 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 6 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/corelib/doc/src/includes/qobject.qdocinc b/src/corelib/doc/src/includes/qobject.qdocinc new file mode 100644 index 0000000000..1af4d3ae33 --- /dev/null +++ b/src/corelib/doc/src/includes/qobject.qdocinc @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [disconnect-all] +\note Disconnecting all signal-slot connections will also disconnect the +\l QObject::destroyed() signal if it is connected. Doing so can adversely +affect classes that rely on this signal for cleaning up resources. It is +recommended to disconnect only the specific signals that were connected by +application code. +//! [disconnect-all] diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index f3fd249d09..28dd89397b 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2960,6 +2960,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho if \a receiver is left out, so you cannot disconnect a specifically-named slot on all objects. + \include includes/qobject.qdocinc disconnect-all + \sa connect() */ bool QObject::disconnect(const QObject *sender, const char *signal, @@ -3095,6 +3097,8 @@ bool QObject::disconnect(const QObject *sender, const char *signal, In the same way \nullptr can be used for \a receiver in the meaning "any receiving object". In this case method should also be QMetaMethod(). \a sender parameter should be never \nullptr. + \include includes/qobject.qdocinc disconnect-all + \sa disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) */ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, @@ -3172,6 +3176,8 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, A signal-slot connection is removed when either of the objects involved are destroyed. + + \include includes/qobject.qdocinc disconnect-all */ /*! |