xwayland: fix shutdown caused by Xwayland/client stop

This commit is contained in:
Dominique Martinet 2017-08-23 23:11:44 +02:00
parent 0196284331
commit fd3ad3b9e4
3 changed files with 6 additions and 9 deletions

View File

@ -18,6 +18,7 @@ struct wlr_xwayland {
time_t server_start;
struct wl_event_source *sigusr1_source;
struct wl_listener destroy_listener;
struct wlr_xwm *xwm;
struct wl_list displayable_windows;
};

View File

@ -107,8 +107,7 @@ static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland);
static void xwayland_destroy_event(struct wl_listener *listener, void *data) {
struct wl_client *client = data;
struct wlr_xwayland *wlr_xwayland = wl_container_of(client, wlr_xwayland, client);
struct wlr_xwayland *wlr_xwayland = wl_container_of(listener, wlr_xwayland, destroy_listener);
/* don't call client destroy */
wlr_xwayland->client = NULL;
@ -120,13 +119,9 @@ static void xwayland_destroy_event(struct wl_listener *listener, void *data) {
}
}
static struct wl_listener xwayland_destroy_listener = {
.notify = xwayland_destroy_event,
};
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
if (wlr_xwayland->client) {
wl_list_remove(&xwayland_destroy_listener.link);
wl_list_remove(&wlr_xwayland->destroy_listener.link);
wl_client_destroy(wlr_xwayland->client);
}
@ -224,7 +219,8 @@ static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
return false;
}
wl_client_add_destroy_listener(wlr_xwayland->client, &xwayland_destroy_listener);
wlr_xwayland->destroy_listener.notify = xwayland_destroy_event;
wl_client_add_destroy_listener(wlr_xwayland->client, &wlr_xwayland->destroy_listener);
struct wl_event_loop *loop = wl_display_get_event_loop(wl_display);
wlr_xwayland->sigusr1_source = wl_event_loop_add_signal(loop, SIGUSR1, xserver_handle_ready, wlr_xwayland);

View File

@ -240,7 +240,7 @@ static void create_surface_handler(struct wl_listener *listener, void *data) {
}
static void xcb_get_resources(struct wlr_xwm *xwm) {
int i;
size_t i;
xcb_intern_atom_cookie_t cookies[ATOM_LAST];
for (i = 0; i < ATOM_LAST; i++) {