summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/api
diff options
context:
space:
mode:
authorMichal Klocek <[email protected]>2025-07-03 09:42:53 +0200
committerMichal Klocek <[email protected]>2025-07-03 13:39:05 +0200
commite86aa68ac75da4e20b55c2bca91d3f98a1e53090 (patch)
treee53c76f01f4700c9ac56d081f323a39e51e88853 /src/webenginequick/api
parent76781b0172fda1cf35d978a5953756d5af88be88 (diff)
Fix crash if ui delegates are not deployedHEADdev
In case delegate for touch handle can not be loaded bail out and simply return nullptr as TouchHandleDrawableQt works fine without delegate (guards against nullptr). Note all other dialog already bailout in case default delegate can not be loaded. Tested on bookworm with 6.8.3 Fixes: QTBUG-111907 Pick-to: 6.10 6.9 6.8 Change-Id: Ib509b63010888fa718f23148c06d973382cad428 Reviewed-by: Michael BrĂ¼ning <[email protected]>
Diffstat (limited to 'src/webenginequick/api')
-rw-r--r--src/webenginequick/api/qquickwebengineview.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp
index dae4a3753..ade8b451c 100644
--- a/src/webenginequick/api/qquickwebengineview.cpp
+++ b/src/webenginequick/api/qquickwebengineview.cpp
@@ -1450,8 +1450,9 @@ QQuickWebEngineViewPrivate::createTouchHandleDelegate(const QMap<int, QImage> &i
{
Q_Q(QQuickWebEngineView);
// lifecycle managed by Chromium's TouchHandleDrawable
- QQuickWebEngineTouchHandle *handle = new QQuickWebEngineTouchHandle();
+ QQuickWebEngineTouchHandle *handle(nullptr);
if (m_touchHandleDelegate) {
+ handle = new QQuickWebEngineTouchHandle();
QQmlContext *qmlContext = QQmlEngine::contextForObject(q);
QQmlContext *context = new QQmlContext(qmlContext, handle);
context->setContextObject(handle);
@@ -1462,7 +1463,9 @@ QQuickWebEngineViewPrivate::createTouchHandleDelegate(const QMap<int, QImage> &i
handle->setItem(item, false);
} else {
QQuickItem *item = ui()->createTouchHandle();
- Q_ASSERT(item);
+ if (!item) {
+ return nullptr;
+ }
QQmlEngine *engine = qmlEngine(item);
Q_ASSERT(engine);
QQuickWebEngineTouchHandleProvider *touchHandleProvider =
@@ -1470,6 +1473,7 @@ QQuickWebEngineViewPrivate::createTouchHandleDelegate(const QMap<int, QImage> &i
engine->imageProvider(QQuickWebEngineTouchHandleProvider::identifier()));
Q_ASSERT(touchHandleProvider);
touchHandleProvider->init(images);
+ handle = new QQuickWebEngineTouchHandle();
handle->setItem(item, true);
}
return handle;