aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-11 23:38:17 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-11 23:38:17 +1000
commitdf95c61044c37b511922db03eb5bd868b374e9d4 (patch)
tree21de258f7e4e3c9deb4f7d49bbd2208ffd248f77 /sway/tree/workspace.c
parentFix line length (diff)
downloadsway-df95c61044c37b511922db03eb5bd868b374e9d4.tar.gz
sway-df95c61044c37b511922db03eb5bd868b374e9d4.tar.zst
sway-df95c61044c37b511922db03eb5bd868b374e9d4.zip
Fix crash in workspace_wrap_children
When workspace_wrap_children is called on a workspace which has a fullscreen child and the fullscreen child is a direct child of the workspace, sway would crash. The workspace's fullscreen pointer is unset when the fullscreen container is detached and applied again when added to a parent, but in this case the parent hadn't yet been added to the workspace which meant con->workspace was NULL. The fix makes container_handle_fullscreen_reparent return if there's no workspace, and the fullscreen pointer is reapplied in workspace_wrap_children.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index d4b57a0f..18746430 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -557,6 +557,7 @@ struct sway_container *workspace_find_container(struct sway_workspace *ws,
557} 557}
558 558
559struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { 559struct sway_container *workspace_wrap_children(struct sway_workspace *ws) {
560 struct sway_container *fs = ws->fullscreen;
560 struct sway_container *middle = container_create(NULL); 561 struct sway_container *middle = container_create(NULL);
561 middle->layout = ws->layout; 562 middle->layout = ws->layout;
562 while (ws->tiling->length) { 563 while (ws->tiling->length) {
@@ -565,6 +566,7 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) {
565 container_add_child(middle, child); 566 container_add_child(middle, child);
566 } 567 }
567 workspace_add_tiling(ws, middle); 568 workspace_add_tiling(ws, middle);
569 ws->fullscreen = fs;
568 return middle; 570 return middle;
569} 571}
570 572