summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <[email protected]>2021-06-10 15:03:28 +0200
committerQt Cherry-pick Bot <[email protected]>2021-06-22 08:08:45 +0000
commit5097029f0581ffe8967c4b9b6e46fd6e334c1602 (patch)
treea2a82fd55641b317b2310760d8e7f0a8ec671198 /tests/auto
parent86255fbddf8f1588a62304229da76b7b4dfe06be (diff)
Don't crash on test end
Allocate the QQuickWebView after the engine, so it is destroyed before its hosting engine is. Fixes: QTBUG-94376 Change-Id: Icfb69505fe68b274acff321f636d77d3f016c1d4 Reviewed-by: Michal Klocek <[email protected]> (cherry picked from commit 0231b0840267a1b1de04275c04c9de726946c5f5) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/webview/qwebview/tst_qwebview.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/webview/qwebview/tst_qwebview.cpp b/tests/auto/webview/qwebview/tst_qwebview.cpp
index 60a9d0f..595935f 100644
--- a/tests/auto/webview/qwebview/tst_qwebview.cpp
+++ b/tests/auto/webview/qwebview/tst_qwebview.cpp
@@ -99,9 +99,9 @@ void tst_QWebView::load()
file.close();
#ifdef QT_WEBVIEW_WEBENGINE_BACKEND
- QQuickWebView qview;
QQmlEngine engine;
QQmlContext *rootContext = engine.rootContext();
+ QQuickWebView qview;
QQmlEngine::setContextForObject(&qview, rootContext);
QWebView &view = qview.webView();
#else
@@ -127,9 +127,9 @@ void tst_QWebView::runJavaScript()
const QString tstProperty = QString(QLatin1String("Qt.tst_data"));
const QString title = QString(QLatin1String("WebViewTitle"));
- QQuickWebView view;
QQmlEngine engine;
QQmlContext *rootContext = engine.rootContext();
+ QQuickWebView view;
QQmlEngine::setContextForObject(&view, rootContext);
QCOMPARE(view.loadProgress(), 0);
@@ -149,9 +149,9 @@ void tst_QWebView::runJavaScript()
void tst_QWebView::loadHtml()
{
#ifdef QT_WEBVIEW_WEBENGINE_BACKEND
- QQuickWebView qview;
QQmlEngine engine;
QQmlContext *rootContext = engine.rootContext();
+ QQuickWebView qview;
QQmlEngine::setContextForObject(&qview, rootContext);
QWebView &view = qview.webView();
#else
@@ -176,9 +176,9 @@ void tst_QWebView::loadRequest()
const QString fileName = file.fileName();
file.close();
#ifdef QT_WEBVIEW_WEBENGINE_BACKEND
- QQuickWebView qview;
QQmlEngine engine;
QQmlContext *rootContext = engine.rootContext();
+ QQuickWebView qview;
QQmlEngine::setContextForObject(&qview, rootContext);
QWebView &view = qview.webView();
#else
@@ -208,9 +208,9 @@ void tst_QWebView::loadRequest()
// LoadFailed
{
#ifdef QT_WEBVIEW_WEBENGINE_BACKEND
- QQuickWebView qview;
QQmlEngine engine;
QQmlContext *rootContext = engine.rootContext();
+ QQuickWebView qview;
QQmlEngine::setContextForObject(&qview, rootContext);
QWebView &view = qview.webView();
#else