aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-07-21 12:05:04 +0200
committerDrew DeVault <sir@cmpwn.com>2020-07-22 13:48:59 -0600
commitcd4827b3b6f2b8b47562e58c4dc8669a0976c282 (patch)
tree435b729dce0889a3431f65f249d8db29afbdbdf5 /xwayland/xwm.c
parent9686895b4e6b1e44132389b57b958f8885d97d77 (diff)
xwayland/xwm: don't insert surface in list on error
In case wl_event_loop_add_timer errors out, don't insert the free'd wlr_xwayland_surface in the list. Closes: https://github.com/swaywm/wlroots/issues/1721
Diffstat (limited to 'xwayland/xwm.c')
-rw-r--r--xwayland/xwm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index a3fb61b4..50a85985 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -141,7 +141,6 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
surface->width = width;
surface->height = height;
surface->override_redirect = override_redirect;
- wl_list_insert(&xwm->surfaces, &surface->link);
wl_list_init(&surface->children);
wl_list_init(&surface->parent_link);
wl_signal_init(&surface->events.destroy);
@@ -182,6 +181,8 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
return NULL;
}
+ wl_list_insert(&xwm->surfaces, &surface->link);
+
wlr_signal_emit_safe(&xwm->xwayland->events.new_surface, surface);
return surface;