aboutsummaryrefslogtreecommitdiff
path: root/backend/multi
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-01-25 11:21:33 +0100
committerSimon Ser <contact@emersion.fr>2024-01-25 12:12:13 +0100
commita82fc4cb8fed4fd6f02684320dfed68760c6b15d (patch)
tree1f707eb9a396f82a91694a897150d113852f0ca1 /backend/multi
parent7c080c3b60a48c9b8602f181a1bc436d5df223e8 (diff)
backend/multi: emit destroy signal before destroying child backends
Some users might want to destroy the multi backend when a child backend is being destroyed. However, they can't destroy the multi backend if it's already in the process of being destroyed. The destroy signal was changed to be emitted after destroying child backends in babdd6ccf757 ("backend: fix use-after-free when destroying backends"). However, this was done to accomodate for an old "output_remove" event on backends, which has long been dropped in favor of wlr_output.events.destroy. This patch follows the same principle as 5d639394f3e8 ("types/output: emit destroy event before destroying global").
Diffstat (limited to 'backend/multi')
-rw-r--r--backend/multi/backend.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 8c36834e..df74fbb1 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -50,6 +50,8 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
wl_list_remove(&backend->display_destroy.link);
+ wlr_backend_finish(wlr_backend);
+
// Some backends may depend on other backends, ie. destroying a backend may
// also destroy other backends
while (!wl_list_empty(&backend->backends)) {
@@ -58,8 +60,6 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) {
wlr_backend_destroy(sub->backend);
}
- // Destroy this backend only after removing all sub-backends
- wlr_backend_finish(wlr_backend);
free(backend);
}