summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInho Lee <inho.lee@qt.io>2025-11-05 10:09:58 +0100
committerLiang Qi <liang.qi@qt.io>2025-11-06 15:23:10 +0000
commit0d4f9625f6873c82ff463ae77a97b6ec9f81ab4a (patch)
treea8340d30a401393cfc980e3991a90a506f14fffc
parentd8e04b5a06c77ffd53c40d05789ad6655af77b1c (diff)
qpa/wayland: fix handling textinput's focus object
Amends c57da9bb0a2d475b72024997657e250d171dcbaa (which is a5ed02659fc78a8f85bac314baf007bfaf30c6f3 in qtwayland) setFocusObject should disable the current surface. Fixes: QTBUG-141475 Pick-to: 6.10 Change-Id: Id5ff55829cad9b8c6c914331d86a1ac4f8fe55ae Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r--src/plugins/platforms/wayland/qwaylandinputcontext.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp
index 0ccc4dba57a..5ab285ad97d 100644
--- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp
+++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp
@@ -192,10 +192,12 @@ void QWaylandInputContext::setFocusObject(QObject *object)
if (window && window->handle()) {
if (mCurrentWindow.data() != window) {
if (!inputMethodAccepted()) {
- auto *surface = static_cast<QWaylandWindow *>(window->handle())->wlSurface();
- if (surface)
- inputInterface->disableSurface(surface);
- mCurrentWindow.clear();
+ if (mCurrentWindow) {
+ auto *surface = static_cast<QWaylandWindow *>(mCurrentWindow->handle())->wlSurface();
+ if (surface)
+ inputInterface->disableSurface(surface);
+ mCurrentWindow.clear();
+ }
} else {
auto *surface = static_cast<QWaylandWindow *>(window->handle())->wlSurface();
if (surface) {