diff --git a/libweston-desktop/internal.h b/libweston-desktop/internal.h index 7a815bd87..2606d279b 100644 --- a/libweston-desktop/internal.h +++ b/libweston-desktop/internal.h @@ -240,5 +240,7 @@ weston_desktop_wl_shell_create(struct weston_desktop *desktop, void weston_desktop_xwayland_init(struct weston_desktop *desktop); +void +weston_desktop_xwayland_fini(struct weston_desktop *desktop); #endif /* WESTON_DESKTOP_INTERNAL_H */ diff --git a/libweston-desktop/libweston-desktop.c b/libweston-desktop/libweston-desktop.c index c1efd2012..2b42ac7e3 100644 --- a/libweston-desktop/libweston-desktop.c +++ b/libweston-desktop/libweston-desktop.c @@ -95,6 +95,8 @@ weston_desktop_destroy(struct weston_desktop *desktop) if (desktop == NULL) return; + weston_desktop_xwayland_fini(desktop); + if (desktop->wl_shell != NULL) wl_global_destroy(desktop->wl_shell); if (desktop->xdg_shell_v6 != NULL) diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c index 711c8a30c..c1c5fc4a7 100644 --- a/libweston-desktop/xwayland.c +++ b/libweston-desktop/xwayland.c @@ -423,3 +423,19 @@ weston_desktop_xwayland_init(struct weston_desktop *desktop) compositor->xwayland = xwayland; compositor->xwayland_interface = &weston_desktop_xwayland_interface; } + +void +weston_desktop_xwayland_fini(struct weston_desktop *desktop) +{ + struct weston_compositor *compositor = weston_desktop_get_compositor(desktop); + struct weston_desktop_xwayland *xwayland; + + xwayland = compositor->xwayland; + + weston_desktop_client_destroy(xwayland->client); + weston_layer_fini(&xwayland->layer); + free(xwayland); + + compositor->xwayland = NULL; + compositor->xwayland_interface = NULL; +}