From 54cd03c41a79cfc64ef56f855da76e0082a71b23 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 14 Jul 2017 14:04:48 +0100 Subject: 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 --- src/client/qwaylandinputcontext.cpp | 6 ++++-- 1 file 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(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); } -- cgit v1.2.3