aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xwayland/xwm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 6846c76f..a0ff4d90 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -1312,6 +1312,11 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
xcb_generic_event_t *event;
struct wlr_xwm *xwm = data;
+ if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) {
+ xwm_destroy(xwm);
+ return 0;
+ }
+
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
count++;
@@ -1493,6 +1498,7 @@ void xwm_destroy(struct wlr_xwm *xwm) {
wl_list_remove(&xwm->compositor_destroy.link);
xcb_disconnect(xwm->xcb_conn);
+ xwm->xwayland->xwm = NULL;
free(xwm);
}