diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-04-16 15:47:14 +0200 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-12-01 18:41:22 +0100 |
| commit | a6c8de2780b6dface7504b5423e064e026a6e564 (patch) | |
| tree | 4ff3283315e6679f0550c4d602dc5bce2c9aec2f /src/qml/jsruntime/qv4engine.cpp | |
| parent | d8a55297c25ff01ffe371bf83631a69db0f521d8 (diff) | |
Alert when we are notifying semi-dead change listeners
Add virtual methods "baseDeleted" and "debugName" to
QQuickItemChangeListener that let us report whether the object that
implements QQuickItemChangeListener is already being destroyed. Add a
"safe" version of QQuickItemChangeListener that overrides that virtual
method using CRTP: if the derived class that it is instantiated with has
a member "inDestructor" (e.g. a QQuickItemPrivate) or "wasDeleted" (e.g.
a QObjectPrivate), then return the value of that variable. If the
derived type is a QObject or QQuickItem, access the member via
QQmlData::wasDeleted.
Ignore calls on listeners that are the same object as the caller.
Use that new type in those classes where it isn't immediately obvious
that they clean up after themselves: classes that don't implement a
destructor are a red flag.
In addition, add a list to safe listener version to add/remove each
item it's listening on.
Issue runtime warnings in developer-builds when listeners are called
for which baseDestroyed() returns true, and when listeners are
destroyed while they still have items on their list.
Task-number: QTBUG-98790
Change-Id: I15ed66a36556caa0e6acf5b768dec2ae92b01d64
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
0 files changed, 0 insertions, 0 deletions
