diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-09-16 22:08:22 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2022-02-10 12:37:02 +0100 |
commit | f5fbc34fc16fc9c6e7f7e8bbbf60f5b343b9466d (patch) | |
tree | 2a8456285c1d79f79ce48842aa16a3760382baf5 /src/webenginequick/api/qquickwebenginescriptcollection_p.h | |
parent | f28c0e6680f3ef8ebb5e82d0fe375afbc6fb0fe9 (diff) | |
download | qtwebengine-f5fbc34fc16fc9c6e7f7e8bbbf60f5b343b9466d.tar.gz |
Fix crash on WebEngine(View|Profile).userScripts.collection get
To create a javascript list on 'collection' method qml engine is needed
for a qml scope, but it's only available for objects, which are created
by the QML Engine itself. The only object in hierarchy of classes is an
actual WebEngineView, so get it from there on collection init.
Also implement delayed initialization of scripts collection for the
usage of default profile through WebEngine singleton, and for the reason
that it's not really needed until really asked by user code.
Pick-to: 6.2 6.3
Fixes: QTBUG-96597
Change-Id: I61e76652a5d0fd5609070fd541816503908f2dc8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginequick/api/qquickwebenginescriptcollection_p.h')
-rw-r--r-- | src/webenginequick/api/qquickwebenginescriptcollection_p.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/webenginequick/api/qquickwebenginescriptcollection_p.h b/src/webenginequick/api/qquickwebenginescriptcollection_p.h index 8c5682706..242118215 100644 --- a/src/webenginequick/api/qquickwebenginescriptcollection_p.h +++ b/src/webenginequick/api/qquickwebenginescriptcollection_p.h @@ -59,7 +59,8 @@ #include <QtWebEngineQuick/private/qtwebenginequickglobal_p.h> QT_BEGIN_NAMESPACE -class QWebEngineScriptCollection; +class QQmlEngine; +class QQuickWebEngineScriptCollectionPrivate; class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineScriptCollection : public QObject { @@ -83,10 +84,12 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QQuickWebEngineScriptCollection) - QQuickWebEngineScriptCollection(QWebEngineScriptCollection *d); - QScopedPointer<QWebEngineScriptCollection> d; + QQuickWebEngineScriptCollection(QQuickWebEngineScriptCollectionPrivate *d); + QScopedPointer<QQuickWebEngineScriptCollectionPrivate> d; friend class QQuickWebEngineProfilePrivate; friend class QQuickWebEngineViewPrivate; + QQmlEngine* qmlEngine(); + void setQmlEngine(QQmlEngine *engine); }; QT_END_NAMESPACE |