diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-01-19 16:19:06 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-02-01 15:14:39 +0100 |
| commit | 27ba69af2f64a8b194655c9fbb276ce981075f75 (patch) | |
| tree | d36ebc5f777a6b7cb2d5c63a61aa841ca5ffae87 /src/qml/jsruntime/qv4qobjectwrapper.cpp | |
| parent | c3474688f68607ffff301c01450f71c4920b501d (diff) | |
QtQml: Clear context objects more thoroughly on destruction
The same object can be the context object of a hierarchy of contexts. So
far we would only clear one of them, leaving dangling pointers in the
others. Clear all the contexts.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Fixes: QTBUG-119326
Change-Id: I509f257672813866e3736b51f430f1243a8577f0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 5463133801..e233b65f4e 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1514,9 +1514,7 @@ void QObjectWrapper::destroyObject(bool lastCall) if (!o->parent() && !ddata->indestructible) { if (ddata && ddata->ownContext) { Q_ASSERT(ddata->ownContext.data() == ddata->context); - ddata->ownContext->emitDestruction(); - if (ddata->ownContext->contextObject() == o) - ddata->ownContext->setContextObject(nullptr); + ddata->ownContext->deepClearContextObject(o); ddata->ownContext.reset(); ddata->context = nullptr; } |
