dnd: ensure internal dnd handlers are unlinked on xwm_destroy()

Fixes #3925

(cherry picked from commit be3d2b74cf)
This commit is contained in:
Consolatis 2024-11-22 18:29:37 +01:00 committed by Simon Zeni
parent f870d63bad
commit b28b269106
3 changed files with 18 additions and 0 deletions

View file

@ -156,6 +156,7 @@ void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
int xwm_handle_selection_event(struct wlr_xwm *xwm, xcb_generic_event_t *event);
int xwm_handle_selection_client_message(struct wlr_xwm *xwm,
xcb_client_message_event_t *ev);
void xwm_seat_unlink_drag_handlers(struct wlr_xwm *xwm);
void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat);

View file

@ -315,6 +315,7 @@ static void seat_handle_drag_source_destroy(struct wl_listener *listener,
wl_container_of(listener, xwm, seat_drag_source_destroy);
wl_list_remove(&xwm->seat_drag_source_destroy.link);
wl_list_init(&xwm->seat_drag_source_destroy.link);
xwm->drag_focus = NULL;
}
@ -337,3 +338,15 @@ void xwm_seat_handle_start_drag(struct wlr_xwm *xwm, struct wlr_drag *drag) {
xwm->seat_drag_source_destroy.notify = seat_handle_drag_source_destroy;
}
}
void xwm_seat_unlink_drag_handlers(struct wlr_xwm *xwm) {
wl_list_remove(&xwm->seat_drag_source_destroy.link);
if (!xwm->drag) {
return;
}
wl_list_remove(&xwm->seat_drag_focus.link);
wl_list_remove(&xwm->seat_drag_motion.link);
wl_list_remove(&xwm->seat_drag_drop.link);
wl_list_remove(&xwm->seat_drag_destroy.link);
}

View file

@ -1879,6 +1879,8 @@ void xwm_destroy(struct wlr_xwm *xwm) {
xwm_selection_finish(&xwm->primary_selection);
xwm_selection_finish(&xwm->dnd_selection);
xwm_seat_unlink_drag_handlers(xwm);
if (xwm->seat) {
if (xwm->seat->selection_source &&
data_source_is_xwayland(xwm->seat->selection_source)) {
@ -2173,6 +2175,8 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) {
wl_list_init(&xwm->surfaces_in_stack_order);
wl_list_init(&xwm->unpaired_surfaces);
wl_list_init(&xwm->pending_startup_ids);
wl_list_init(&xwm->seat_drag_source_destroy.link);
xwm->ping_timeout = 10000;
xwm->xcb_conn = xcb_connect_to_fd(wm_fd, NULL);