clients: Add more sanity checks to catch destroyed window
Add a sanity check to touch_handle_down() and data_device_enter() as what we did for pointer and keyboard. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
@@ -3246,6 +3246,11 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
|
|||||||
float sx = wl_fixed_to_double(x_w);
|
float sx = wl_fixed_to_double(x_w);
|
||||||
float sy = wl_fixed_to_double(y_w);
|
float sy = wl_fixed_to_double(y_w);
|
||||||
|
|
||||||
|
if (!surface) {
|
||||||
|
/* down event for a window we've just destroyed */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
input->display->serial = serial;
|
input->display->serial = serial;
|
||||||
input->touch_focus = wl_surface_get_user_data(surface);
|
input->touch_focus = wl_surface_get_user_data(surface);
|
||||||
if (!input->touch_focus) {
|
if (!input->touch_focus) {
|
||||||
@@ -3601,6 +3606,11 @@ data_device_enter(void *data, struct wl_data_device *data_device,
|
|||||||
float y = wl_fixed_to_double(y_w);
|
float y = wl_fixed_to_double(y_w);
|
||||||
char **p;
|
char **p;
|
||||||
|
|
||||||
|
if (!surface) {
|
||||||
|
/* enter event for a window we've just destroyed */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
window = wl_surface_get_user_data(surface);
|
window = wl_surface_get_user_data(surface);
|
||||||
input->drag_enter_serial = serial;
|
input->drag_enter_serial = serial;
|
||||||
input->drag_focus = window,
|
input->drag_focus = window,
|
||||||
|
|||||||
Reference in New Issue
Block a user