aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmlconnections.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-11-07 15:52:54 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-11-28 13:12:02 +0000
commit6cd8d209ec472a658a330f25b84f92cd61e0d4cf (patch)
tree790f8b6bf1074ab1e9b8d1bbb7f23ba2970b9c0b /src/qml/types/qqmlconnections.cpp
parentb6ba7e9c9023d1d5c6ba543c1c551344b7a9e5b5 (diff)
Connections: Don't crash when target is deleted
Pick-to: 6.4 6.2 Fixes: QTBUG-108697 Change-Id: I019edf3a0a702ad1dca340473265933e4d131e99 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/types/qqmlconnections.cpp')
-rw-r--r--src/qml/types/qqmlconnections.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index e10327e240..1527a2ea34 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -24,15 +24,13 @@ Q_LOGGING_CATEGORY(lcQmlConnections, "qt.qml.connections")
class QQmlConnectionsPrivate : public QObjectPrivate
{
public:
- QQmlConnectionsPrivate() : target(nullptr), enabled(true), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {}
-
QList<QQmlBoundSignal*> boundsignals;
- QObject *target;
+ QQmlGuard<QObject> target;
- bool enabled;
- bool targetSet;
- bool ignoreUnknownSignals;
- bool componentcomplete;
+ bool enabled = true;
+ bool targetSet = false;
+ bool ignoreUnknownSignals = false;
+ bool componentcomplete = true;
QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit;
QList<const QV4::CompiledData::Binding *> bindings;
@@ -119,7 +117,7 @@ QQmlConnections::QQmlConnections(QObject *parent) :
QObject *QQmlConnections::target() const
{
Q_D(const QQmlConnections);
- return d->targetSet ? d->target : parent();
+ return d->targetSet ? d->target.data() : parent();
}
class QQmlBoundSignalDeleter : public QObject