summaryrefslogtreecommitdiffstats
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
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]>
-rw-r--r--src/webenginequick/api/qquickwebengineview.cpp8
-rw-r--r--src/webenginequick/ui_delegates_manager.cpp1
2 files changed, 7 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;
diff --git a/src/webenginequick/ui_delegates_manager.cpp b/src/webenginequick/ui_delegates_manager.cpp
index f2488a7c2..93ac63422 100644
--- a/src/webenginequick/ui_delegates_manager.cpp
+++ b/src/webenginequick/ui_delegates_manager.cpp
@@ -154,6 +154,7 @@ bool UIDelegatesManager::ensureComponentLoaded(ComponentType type)
}
return true;
}
+ qWarning("Default ui delegate %s can not be found.", qPrintable(fileName));
return false;
}