aboutsummaryrefslogtreecommitdiff
path: root/backend/session
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-08 11:17:56 +0100
committeremersion <contact@emersion.fr>2017-12-08 11:17:56 +0100
commit6001235b0465ba1961f8abd66a860bcf1f14fc22 (patch)
tree54990a94dfed153905686f839247d774a5430a06 /backend/session
parente30b943fbd33c71f633deaf3f55279d30f214929 (diff)
Listen to display destroy in session
It's not the backend's responsibility to destroy the session anymore.
Diffstat (limited to 'backend/session')
-rw-r--r--backend/session/session.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/backend/session/session.c b/backend/session/session.c
index 657558fd..0ed54499 100644
--- a/backend/session/session.c
+++ b/backend/session/session.c
@@ -58,6 +58,12 @@ out:
return 1;
}
+static void handle_display_destroy(struct wl_listener *listener, void *data) {
+ struct wlr_session *session =
+ wl_container_of(listener, session, display_destroy);
+ wlr_session_destroy(session);
+}
+
struct wlr_session *wlr_session_create(struct wl_display *disp) {
struct wlr_session *session = NULL;
const struct session_impl **iter;
@@ -100,6 +106,9 @@ struct wlr_session *wlr_session_create(struct wl_display *disp) {
goto error_mon;
}
+ session->display_destroy.notify = handle_display_destroy;
+ wl_display_add_destroy_listener(disp, &session->display_destroy);
+
return session;
error_mon:
@@ -107,7 +116,7 @@ error_mon:
error_udev:
udev_unref(session->udev);
error_session:
- wlr_session_destroy(session);
+ session->impl->destroy(session);
return NULL;
}
@@ -116,6 +125,8 @@ void wlr_session_destroy(struct wlr_session *session) {
return;
}
+ wl_list_remove(&session->display_destroy.link);
+
wl_event_source_remove(session->udev_event);
udev_monitor_unref(session->mon);
udev_unref(session->udev);