diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-09-20 10:56:51 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-09-21 15:19:05 +0200 |
commit | c249edb83fa67b3e5f711b28923397e66876182d (patch) | |
tree | 002fa44555b7762fd95f03f9d3252e72985c0a49 /src/qml/jsruntime | |
parent | 64a3e205edfe0de8283bbc83d65ec808464d0ab5 (diff) |
disconnectNotifiers() more aggressively during object deletion
When an object is queued for deletion, there is no point in notifying
anyone anymore. The change notifications almost always result in the
property that changes being read. Reading a property from a half-deleted
scope object silently returns undefined, no matter what type the
property is. Reading a property from a half-deleted object via some
qualified lookup throws a type error. Neither of those is useful.
Furthermore, when an object is deleted, often a large number of
properties change, triggering a lot of unnecessary computation.
[ChangeLog][QML][Important Behavior Changes] When an object is queued
for deletion, for example because its parent object is being deleted,
then all of its change notifiers are dropped. This means no binding or
signal handler that depends on properties of such an object will be
triggered anymore. As you cannot read properties from such half-deleted
objects anyway, there was never a point in being notified about further
property changes. There may be corner cases where the notifications are
used for some unrelated processing, though.
Task-number: QTBUG-95262
Change-Id: I7bab0e42dd892921be259ea764160f99a46a322d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 1d5d3dedf7..6657f3d6fc 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1285,6 +1285,7 @@ void QObjectWrapper::destroyObject(bool lastCall) } // This object is notionally destroyed now ddata->isQueuedForDeletion = true; + ddata->disconnectNotifiers(); if (lastCall) delete h->object(); else |