summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2017-07-14 14:04:48 +0100
committerDavid Edmundson <davidedmundson@kde.org>2017-08-09 16:11:27 +0000
commit54cd03c41a79cfc64ef56f855da76e0082a71b23 (patch)
treeb92ef445b31b4240c4d418a7d9a82393fb365266
parent6e6473699e3fe99b114b151c9a9e03f4dd183c89 (diff)
Check surface exists when setting textinput focus
QWaylandWindow resets the surface on various events. Handling focus comes in a posted event, so this can be after we've hidden a window and lost a surface. Task-number: QTBUG-61704 Change-Id: I535ff78c6bc2b86816696a08f8eebc47186d1225 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--src/client/qwaylandinputcontext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp
index dcc4ad5c7..fac5fb840 100644
--- a/src/client/qwaylandinputcontext.cpp
+++ b/src/client/qwaylandinputcontext.cpp
@@ -541,8 +541,10 @@ void QWaylandInputContext::setFocusObject(QObject *)
if (window && window->handle() && inputMethodAccepted()) {
if (mCurrentWindow.data() != window) {
struct ::wl_surface *surface = static_cast<QWaylandWindow *>(window->handle())->object();
- textInput()->enable(surface);
- mCurrentWindow = window;
+ if (surface) {
+ textInput()->enable(surface);
+ mCurrentWindow = window;
+ }
}
textInput()->updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter);
}