summaryrefslogtreecommitdiff
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-26 13:56:11 +0100
commit560d8a3bb8853c3d5a20d23aec77ee00ba71b718 (patch)
treee1d83654cf6365f5265d4de198d35277b1bef9b1
parentb3995c860510ee3892c154e2886d300898c17b5e (diff)
downloadqtwayland-560d8a3bb8853c3d5a20d23aec77ee00ba71b718.tar.gz
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 Change-Id: I262a5c15f87ba13d750425c259583919cd947ea4 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit e08b25efe4a7bec1004696bd23d9f8959158bd60) Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-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 e19b3434..5a77ebd0 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()