Android: Bail early in showInputPanel() when focusWindow is not native

QAndroidInputContext::showInputPanel() assumes that any window with
focus must be a native window, but sometimes the focus window will be
an offscreen window, like in the case of using OpenXR where there is no
native window to be focused.  In that case the 2D input method overlay
doesn't even make sense, since there is no window space to even map back
to. This patch prevents crashes when trying to focus on text in Android
VR/XR applications.

Change-Id: I16ac1a07f0a86ec9786f09a2f416387c1885bde0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Andy Nichols 2024-01-11 17:58:56 +01:00
parent 40cff9e93c
commit 49bc01b2cb

View File

@ -884,6 +884,9 @@ void QAndroidInputContext::showInputPanel()
if (query.isNull())
return;
if (!qGuiApp->focusWindow()->handle())
return; // not a real window, probably VR/XR
disconnect(m_updateCursorPosConnection);
m_updateCursorPosConnection = {};