aboutsummaryrefslogtreecommitdiff
path: root/backend/headless
diff options
context:
space:
mode:
Diffstat (limited to 'backend/headless')
-rw-r--r--backend/headless/backend.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index 8eadd3b7..7758ece4 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -47,6 +47,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) {
}
wl_list_remove(&backend->display_destroy.link);
+ wl_list_remove(&backend->renderer_destroy.link);
struct wlr_headless_output *output, *output_tmp;
wl_list_for_each_safe(output, output_tmp, &backend->outputs, link) {
@@ -61,8 +62,8 @@ static void backend_destroy(struct wlr_backend *wlr_backend) {
wlr_signal_emit_safe(&wlr_backend->events.destroy, backend);
- wlr_renderer_destroy(backend->renderer);
if (backend->egl == &backend->priv_egl) {
+ wlr_renderer_destroy(backend->renderer);
wlr_egl_finish(&backend->priv_egl);
}
free(backend);
@@ -87,6 +88,12 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
backend_destroy(&backend->backend);
}
+static void handle_renderer_destroy(struct wl_listener *listener, void *data) {
+ struct wlr_headless_backend *backend =
+ wl_container_of(listener, backend, renderer_destroy);
+ backend_destroy(&backend->backend);
+}
+
static bool backend_init(struct wlr_headless_backend *backend,
struct wl_display *display, struct wlr_renderer *renderer) {
wlr_backend_init(&backend->backend, &backend_impl);
@@ -112,6 +119,8 @@ static bool backend_init(struct wlr_headless_backend *backend,
backend->display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &backend->display_destroy);
+ wl_list_init(&backend->renderer_destroy.link);
+
return true;
}
@@ -173,6 +182,9 @@ struct wlr_backend *wlr_headless_backend_create_with_renderer(
return NULL;
}
+ backend->renderer_destroy.notify = handle_renderer_destroy;
+ wl_signal_add(&renderer->events.destroy, &backend->renderer_destroy);
+
return &backend->backend;
}