diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/backend.c | 10 | ||||
-rw-r--r-- | backend/libinput/backend.c | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 541e720f..8a10a51e 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -44,6 +44,7 @@ static void backend_destroy(struct wlr_backend *backend) { wlr_signal_emit_safe(&backend->events.destroy, backend); wl_list_remove(&drm->display_destroy.link); + wl_list_remove(&drm->session_destroy.link); wl_list_remove(&drm->session_signal.link); wl_list_remove(&drm->drm_invalidated.link); @@ -135,6 +136,12 @@ static void drm_invalidated(struct wl_listener *listener, void *data) { scan_drm_connectors(drm); } +static void handle_session_destroy(struct wl_listener *listener, void *data) { + struct wlr_drm_backend *drm = + wl_container_of(listener, drm, session_destroy); + backend_destroy(&drm->backend); +} + static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_drm_backend *drm = wl_container_of(listener, drm, display_destroy); @@ -197,6 +204,9 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, goto error_event; } + drm->session_destroy.notify = handle_session_destroy; + wl_signal_add(&session->events.destroy, &drm->session_destroy); + drm->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &drm->display_destroy); diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 8106af00..87497b11 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -121,6 +121,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) { wlr_signal_emit_safe(&wlr_backend->events.destroy, wlr_backend); wl_list_remove(&backend->display_destroy.link); + wl_list_remove(&backend->session_destroy.link); wl_list_remove(&backend->session_signal.link); wlr_list_finish(&backend->wlr_device_lists); @@ -156,6 +157,12 @@ static void session_signal(struct wl_listener *listener, void *data) { } } +static void handle_session_destroy(struct wl_listener *listener, void *data) { + struct wlr_libinput_backend *backend = + wl_container_of(listener, backend, session_destroy); + backend_destroy(&backend->backend); +} + static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_libinput_backend *backend = wl_container_of(listener, backend, display_destroy); @@ -183,6 +190,9 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, backend->session_signal.notify = session_signal; wl_signal_add(&session->session_signal, &backend->session_signal); + backend->session_destroy.notify = handle_session_destroy; + wl_signal_add(&session->events.destroy, &backend->session_destroy); + backend->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &backend->display_destroy); |