backend-x11: Move back-end removal to the destroy function

Otherwise we end up with an invalid backend on the shutdown path of the
compositor. This mimics what the wayland back-end does.

Fixes 14c52a942b, 'backend-x11: enable multi-backend support'.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2023-10-23 20:09:34 +03:00
parent 5d7412c1bd
commit 8d85c43355
1 changed files with 2 additions and 1 deletions

View File

@ -1840,7 +1840,6 @@ x11_shutdown(struct weston_backend *base)
{ {
struct x11_backend *backend = to_x11_backend(base); struct x11_backend *backend = to_x11_backend(base);
wl_list_remove(&backend->base.link);
wl_event_source_remove(backend->xcb_source); wl_event_source_remove(backend->xcb_source);
x11_input_destroy(backend); x11_input_destroy(backend);
@ -1853,6 +1852,8 @@ x11_destroy(struct weston_backend *base)
struct weston_compositor *ec = backend->compositor; struct weston_compositor *ec = backend->compositor;
struct weston_head *head, *next; struct weston_head *head, *next;
wl_list_remove(&backend->base.link);
wl_list_for_each_safe(head, next, &ec->head_list, compositor_link) { wl_list_for_each_safe(head, next, &ec->head_list, compositor_link) {
if (to_x11_head(head)) if (to_x11_head(head))
x11_head_destroy(head); x11_head_destroy(head);