aboutsummaryrefslogtreecommitdiff
path: root/backend/multi
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-12-21 08:13:36 -0500
committerTony Crisci <tony@dubstepdish.com>2017-12-21 08:17:35 -0500
commitd1dce19253d0b4d30d99d2074a05fe7970391a61 (patch)
tree839db2f21c4eb69927b6dadc789bf2d2de7238e7 /backend/multi
parent6c8fd6017e92441e8b1702958f34fd9d88e32928 (diff)
handle display destroy
Diffstat (limited to 'backend/multi')
-rw-r--r--backend/multi/backend.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 0dd3c54b..07e84c01 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -44,7 +44,6 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)wlr_backend;
struct subbackend_state *sub, *next;
wl_list_for_each_safe(sub, next, &backend->backends, link) {
- // XXX do we really want to take ownership over added backends?
wlr_backend_destroy(sub->backend);
}
free(backend);
@@ -68,6 +67,12 @@ struct wlr_backend_impl backend_impl = {
.get_egl = multi_backend_get_egl,
};
+static void handle_display_destroy(struct wl_listener *listener, void *data) {
+ struct wlr_multi_backend *backend =
+ wl_container_of(listener, backend, display_destroy);
+ multi_backend_destroy((struct wlr_backend*)backend);
+}
+
struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
struct wlr_multi_backend *backend =
calloc(1, sizeof(struct wlr_multi_backend));
@@ -82,6 +87,9 @@ struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
wl_signal_init(&backend->events.backend_add);
wl_signal_init(&backend->events.backend_remove);
+ backend->display_destroy.notify = handle_display_destroy;
+ wl_display_add_destroy_listener(display, &backend->display_destroy);
+
return &backend->backend;
}