diff options
author | pastel raschke <stel@comfy.monster> | 2023-12-18 11:15:29 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-12-18 11:15:51 +0100 |
commit | 3bf9000a52025cde4d5e99881decb2b5ca4c04e3 (patch) | |
tree | 3c8107277176576f3bd241384155b0e5fabc68ba | |
parent | 6ee5bd9eeeb94266664b894a835987de67c0530a (diff) | |
download | wlroots-3bf9000a52025cde4d5e99881decb2b5ca4c04e3.tar.xz |
input-method-v2: validate commit serial
-rw-r--r-- | types/wlr_input_method_v2.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/types/wlr_input_method_v2.c b/types/wlr_input_method_v2.c index 227f5fb4..512adb31 100644 --- a/types/wlr_input_method_v2.c +++ b/types/wlr_input_method_v2.c @@ -80,10 +80,15 @@ static void im_commit(struct wl_client *client, struct wl_resource *resource, if (!input_method) { return; } + if (serial != input_method->current_serial) { + free(input_method->pending.commit_text); + free(input_method->pending.preedit.text); + input_method->pending = (struct wlr_input_method_v2_state){0}; + return; + } free(input_method->current.commit_text); free(input_method->current.preedit.text); input_method->current = input_method->pending; - input_method->current_serial = serial; input_method->pending = (struct wlr_input_method_v2_state){0}; wl_signal_emit_mutable(&input_method->events.commit, input_method); } |