From eedb9df531ae73061c0f72ef2944df6f0068f6cd Mon Sep 17 00:00:00 2001 From: Ferdinand Bachmann Date: Sun, 27 Mar 2022 23:21:32 +0200 Subject: types/wlr_pointer_gestures_v1: null-check both focused_surface and focused_client (fixes #3385) --- types/wlr_pointer_gestures_v1.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/types/wlr_pointer_gestures_v1.c b/types/wlr_pointer_gestures_v1.c index b8229dfc..1601b792 100644 --- a/types/wlr_pointer_gestures_v1.c +++ b/types/wlr_pointer_gestures_v1.c @@ -52,7 +52,9 @@ void wlr_pointer_gestures_v1_send_swipe_begin( uint32_t time_msec, uint32_t fingers) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -79,7 +81,9 @@ void wlr_pointer_gestures_v1_send_swipe_update( double dx, double dy) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -103,7 +107,9 @@ void wlr_pointer_gestures_v1_send_swipe_end( uint32_t time_msec, bool cancelled) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -164,7 +170,9 @@ void wlr_pointer_gestures_v1_send_pinch_begin( uint32_t time_msec, uint32_t fingers) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -193,7 +201,9 @@ void wlr_pointer_gestures_v1_send_pinch_update( double scale, double rotation) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -219,7 +229,9 @@ void wlr_pointer_gestures_v1_send_pinch_end( uint32_t time_msec, bool cancelled) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -285,7 +297,9 @@ void wlr_pointer_gestures_v1_send_hold_begin( uint32_t time_msec, uint32_t fingers) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } @@ -311,7 +325,9 @@ void wlr_pointer_gestures_v1_send_hold_end( uint32_t time_msec, bool cancelled) { struct wlr_surface *focus = seat->pointer_state.focused_surface; - if (focus == NULL) { + struct wlr_seat_client *focus_seat_client = + seat->pointer_state.focused_client; + if (focus == NULL || focus_seat_client == NULL) { return; } -- cgit v1.2.3