summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidinputcontext.cpp
diff options
context:
space:
mode:
authorAndy Nichols <nezticle@gmail.com>2024-01-11 17:58:56 +0100
committerAndy Nichols <nezticle@gmail.com>2024-01-15 16:19:32 +0100
commit49bc01b2cb3063144f420e2fd572b626f2849da8 (patch)
tree4f56c7c5e6c9cd83d3b698fa2aa1e5c8b594d555 /src/plugins/platforms/android/qandroidinputcontext.cpp
parent40cff9e93c36edcab49c08fa65760c22dc935992 (diff)
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>
Diffstat (limited to 'src/plugins/platforms/android/qandroidinputcontext.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 68a1ba0d07..f6404fb00a 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -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 = {};