summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandtextinputmanager.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-02-19 11:41:12 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-03-24 09:02:06 +0100
commite08b25efe4a7bec1004696bd23d9f8959158bd60 (patch)
tree1bf183a145ece1ddbb2a3b446e00256015ba66b0 /src/compositor/extensions/qwaylandtextinputmanager.cpp
parent55da3f136d845c0af8fd71d5903a8a94c59b3324 (diff)
Fix race condition when attaching client to text input
Extensions are registered by initialize(), which is called as a polish event later. Therefore the following race can happen: 1. Application #1 requests a text-input object. The compositor sees that the seat has no such object and creates a new one. 2. Polish event is posted. 3. Application #2 requests a text-input object. Since the polish event is not yet processed, it also creates a new one. 4. Second polish event posted. 5. Both polish events processed. We end up with two competing text-input objects, one per client. This in turn leads to enter/leave events not being sent correctly, and the client may therefore end up not updating the keyboard hints. The result was arbitrary behavior: Sometimes the keyboard would not open at all, whereas other times it would open with the current input method hints, even if these do not match the hints of the editor. [ChangeLog][Input] Fixed a problem where a virtual keyboard would not be updated correctly if two clients were started at almost the same time. Fixes: QTBUG-91096 Pick-to: 6.1 6.0 5.15 Change-Id: I262a5c15f87ba13d750425c259583919cd947ea4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor/extensions/qwaylandtextinputmanager.cpp')
-rw-r--r--src/compositor/extensions/qwaylandtextinputmanager.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandtextinputmanager.cpp b/src/compositor/extensions/qwaylandtextinputmanager.cpp
index 495ebae84..d9938d1f3 100644
--- a/src/compositor/extensions/qwaylandtextinputmanager.cpp
+++ b/src/compositor/extensions/qwaylandtextinputmanager.cpp
@@ -51,6 +51,8 @@ void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(R
textInput = new QWaylandTextInput(seat, compositor);
}
textInput->add(resource->client(), id, wl_resource_get_version(resource->handle));
+ if (!textInput->isInitialized())
+ textInput->initialize();
}
QWaylandTextInputManager::QWaylandTextInputManager()