From 78a09573af43f30765393b2aff9a90f4c92a1dc3 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Thu, 23 Nov 2023 21:20:15 +0300 Subject: [PATCH] output: fix display destroy listener double removal Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3762 --- types/output/output.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/output/output.c b/types/output/output.c index a2ae5002..8d2bb9c9 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -146,7 +146,6 @@ void wlr_output_create_global(struct wlr_output *output, struct wl_display *disp } wl_list_remove(&output->display_destroy.link); - output->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &output->display_destroy); } @@ -443,7 +442,9 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, } wlr_addon_set_init(&output->addons); + wl_list_init(&output->display_destroy.link); + output->display_destroy.notify = handle_display_destroy; if (state) { output_apply_state(output, state); @@ -455,10 +456,11 @@ void wlr_output_destroy(struct wlr_output *output) { return; } - wl_list_remove(&output->display_destroy.link); wlr_output_destroy_global(output); output_clear_back_buffer(output); + wl_list_remove(&output->display_destroy.link); + wl_signal_emit_mutable(&output->events.destroy, output); wlr_addon_set_finish(&output->addons);