Skip to content

Commit

Permalink
Wasm: fix QtVirtualKeyboard crash
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Piotr Wierciński <[email protected]>
(cherry picked from commit 41cb01d)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit f01a0e9)
  • Loading branch information
lpotter authored and Qt Cherry-pick Bot committed Jun 7, 2024
1 parent a428c69 commit b5fbe09
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/plugins/platforms/wasm/qwasmwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b5fbe09

Please sign in to comment.