aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-06-25 16:41:31 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-06-25 16:41:31 +1000
commit9b15e81cff62eb214c89f62bc9e499c7f21d86cf (patch)
tree99e43e2160bae56fa7cc0dbef543ef874b381b01
parentc371ff3de8abbaf3428eadb905d7f940281196c1 (diff)
Fix potential crash when fullscreen view unmaps
It happened when a view is a grandchild or deeper of the workspace, is fullscreen, and unmaps. The workspace would not be included in the transaction and its pointer to the fullscreen view was left dangling.
-rw-r--r--sway/tree/view.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index cb36f123..2ca0dbbb 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -542,14 +542,16 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
struct sway_container *view_unmap(struct sway_view *view) {
wl_signal_emit(&view->events.unmap, view);
+ wl_list_remove(&view->surface_new_subsurface.link);
+ wl_list_remove(&view->container_reparent.link);
+
if (view->is_fullscreen) {
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
ws->sway_workspace->fullscreen = NULL;
+ container_destroy(view->swayc);
+ return ws;
}
- wl_list_remove(&view->surface_new_subsurface.link);
- wl_list_remove(&view->container_reparent.link);
-
return container_destroy(view->swayc);
}