diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-10 09:28:12 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-10-10 16:01:48 +0200 |
commit | 102fa9b6db82ecd2b95d168912fde0c8bc3798b3 (patch) | |
tree | 5bf934c323dcafb67cb508ace579110191ad782d /src/quick/items/qquickview.cpp | |
parent | a6be2d77aa6dc9f834b971eaff749a02cf982525 (diff) | |
parent | fff4477661ae240c43088fa6d9069ccf969dbee8 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
examples/quick/quickwidgets/quickwidget/main.cpp
src/qml/jsruntime/qv4jsonobject.cpp
src/qml/jsruntime/qv4qobjectwrapper.cpp
src/qml/jsruntime/qv4qobjectwrapper_p.h
src/qml/qml/qqmlengine.cpp
src/qml/qml/qqmlpropertycache.cpp
src/qml/qml/qqmlpropertycache_p.h
src/quick/items/qquickanimatedsprite.cpp
src/quick/items/qquickitem.cpp
src/quick/items/qquickitem.h
src/quick/items/qquickitem_p.h
src/quick/items/qquickview_p.h
src/quick/scenegraph/qsgcontext.cpp
src/quick/scenegraph/qsgdefaultrendercontext.cpp
Change-Id: I172c6fbff97208f21ed4c8b6db3d1747a889f22b
Diffstat (limited to 'src/quick/items/qquickview.cpp')
-rw-r--r-- | src/quick/items/qquickview.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index d79d8ba3cd..a167f01484 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -48,29 +48,11 @@ #include <QtQml/qqmlengine.h> #include <private/qqmlengine_p.h> +#include <private/qv4qobjectwrapper_p.h> #include <QtCore/qbasictimer.h> QT_BEGIN_NAMESPACE -DEFINE_OBJECT_VTABLE(QV4::QQuickRootItemMarker); - -QV4::Heap::QQuickRootItemMarker *QV4::QQuickRootItemMarker::create(QQmlEngine *engine, QQuickWindow *window) -{ - QV4::ExecutionEngine *e = QQmlEnginePrivate::getV4Engine(engine); - return e->memoryManager->allocObject<QQuickRootItemMarker>(window); -} - -void QV4::QQuickRootItemMarker::markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e) -{ - QQuickItem *root = static_cast<QQuickRootItemMarker::Data *>(that)->window->contentItem(); - if (root) { - QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(root); - rootPrivate->markObjects(e); - } - - QV4::Object::markObjects(that, e); -} - void QQuickViewPrivate::init(QQmlEngine* e) { Q_Q(QQuickView); @@ -84,10 +66,10 @@ void QQuickViewPrivate::init(QQmlEngine* e) engine.data()->setIncubationController(q->incubationController()); { + // 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 = QQmlEnginePrivate::getV4Engine(engine.data()); - QV4::Scope scope(v4); - QV4::Scoped<QV4::QQuickRootItemMarker> v(scope, QV4::QQuickRootItemMarker::create(engine.data(), q)); - rootItemMarker.set(v4, v); + QV4::QObjectWrapper::wrap(v4, contentItem); } } |