mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	input-method-v2: validate commit serial
(cherry picked from commit 3bf9000a52)
			
			
This commit is contained in:
		
							parent
							
								
									9f1a31e7f3
								
							
						
					
					
						commit
						fc66ba68e3
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -80,10 +80,15 @@ static void im_commit(struct wl_client *client, struct wl_resource *resource,
 | 
				
			||||||
	if (!input_method) {
 | 
						if (!input_method) {
 | 
				
			||||||
		return;
 | 
							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.commit_text);
 | 
				
			||||||
	free(input_method->current.preedit.text);
 | 
						free(input_method->current.preedit.text);
 | 
				
			||||||
	input_method->current = input_method->pending;
 | 
						input_method->current = input_method->pending;
 | 
				
			||||||
	input_method->current_serial = serial;
 | 
					 | 
				
			||||||
	input_method->pending = (struct wlr_input_method_v2_state){0};
 | 
						input_method->pending = (struct wlr_input_method_v2_state){0};
 | 
				
			||||||
	wl_signal_emit_mutable(&input_method->events.commit, input_method);
 | 
						wl_signal_emit_mutable(&input_method->events.commit, input_method);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue