diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-02-20 16:03:35 +0100 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-03-05 14:06:29 +0100 |
| commit | b871644b31a5fc1f410e0759f0b51f5418dc8f34 (patch) | |
| tree | cc3ef154a6e52b34785d17649b8d6e2471549e72 /src/quick/items/qquickview.cpp | |
| parent | 970828df9c134859d3ceb352e53374c94d1eeb07 (diff) | |
Prepare for white allocations (7/9): QQuick(Window|View)
Prevent QObjectWrapper from being gced - if we use white alloctations,
and the weak values have already been marked, then nothing will mark the
newly created QObjectWrapper. Use a helper function which takes care of
the marking, and call it in the appropriate places. Also mark the normal
wrap and wrapConst functions as [[nodiscard]] to avoid this issue from
resurfacing in the future, and adjust a few call-sites to also call
ensureWrapper.
Change-Id: I8d4c73ae62b61d21b1456a3b096fc6a42f302160
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/quick/items/qquickview.cpp')
| -rw-r--r-- | src/quick/items/qquickview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index 2481718d62..cb9fab654c 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -35,7 +35,7 @@ void QQuickViewPrivate::init(QQmlEngine* e) // The content item has CppOwnership policy (set in QQuickWindow). Ensure the presence of a JS // wrapper so that the garbage collector can see the policy. QV4::ExecutionEngine *v4 = engine.data()->handle(); - QV4::QObjectWrapper::wrap(v4, contentItem); + QV4::QObjectWrapper::ensureWrapper(v4, contentItem); } } |
