summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2024-05-07 09:06:44 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-06-07 14:44:04 +0000
commitb5fbe0923cfc566036b83c3d968f225b26117efc (patch)
treee20f5228e4216607d6d8713433f9535527132aed
parenta428c6933565ee8368367534cf306ccc6957f5a5 (diff)
Wasm: fix QtVirtualKeyboard crashv6.7.26.7.2
Do not try to access non the existent input element when there is no touchscreen, as we do not use it in that instance. Fixes: QTBUG-125120 Change-Id: Iedac1890d13b348ef12690947779347e3c2f8476 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io> (cherry picked from commit 41cb01dc595c8de374ce58ae43afbb69db70c379) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit f01a0e9ed90cd970d5b089648424ab4af1aed594)
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index cda1faac8d..19c73255d4 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -128,9 +128,8 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport,
});
emscripten::val keyFocusWindow;
- if (QWasmIntegration::get()->inputContext()) {
- QWasmInputContext *wasmContext =
- static_cast<QWasmInputContext *>(QWasmIntegration::get()->inputContext());
+ if (QWasmInputContext *wasmContext =
+ qobject_cast<QWasmInputContext *>(QWasmIntegration::get()->inputContext())) {
// if there is an touchscreen input context,
// use that window for key input
keyFocusWindow = wasmContext->m_inputElement;