Skip to content

Commit e2239c3

Browse files
committed
wayland: Ensure that the tablet tool list is always initialized to empty
Otherwise, it will be left in an uninitialized, non-empty state if the tablet protocol isn't present.
1 parent ec12971 commit e2239c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/video/wayland/SDL_waylandevents.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,7 +3309,6 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
33093309

33103310
static void Wayland_SeatInitTabletSupport(SDL_WaylandSeat *seat)
33113311
{
3312-
WAYLAND_wl_list_init(&seat->tablet.tool_list);
33133312
seat->tablet.wl_tablet_seat = zwp_tablet_manager_v2_get_tablet_seat(seat->display->tablet_manager, seat->wl_seat);
33143313
zwp_tablet_seat_v2_add_listener(seat->tablet.wl_tablet_seat, &tablet_seat_listener, seat);
33153314
}
@@ -3342,7 +3341,7 @@ static void Wayland_SeatDestroyTablet(SDL_WaylandSeat *seat, bool send_events)
33423341
SDL_RemoveAllPenDevices(Wayland_remove_all_pens_callback, NULL);
33433342
}
33443343

3345-
if (seat && seat->tablet.wl_tablet_seat) {
3344+
if (seat->tablet.wl_tablet_seat) {
33463345
zwp_tablet_seat_v2_destroy(seat->tablet.wl_tablet_seat);
33473346
seat->tablet.wl_tablet_seat = NULL;
33483347
}
@@ -3362,6 +3361,7 @@ void Wayland_DisplayCreateSeat(SDL_VideoData *display, struct wl_seat *wl_seat,
33623361
WAYLAND_wl_list_insert(display->seat_list.prev, &seat->link);
33633362

33643363
WAYLAND_wl_list_init(&seat->touch.points);
3364+
WAYLAND_wl_list_init(&seat->tablet.tool_list);
33653365
seat->wl_seat = wl_seat;
33663366
seat->display = display;
33673367
seat->registry_id = id;

0 commit comments

Comments
 (0)