aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar mwenzkowski <29407878+mwenzkowski@users.noreply.github.com>2020-10-24 17:27:38 +0200
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-10-24 19:40:25 -0400
commit13a67da614449ec95d1dc1927ed7dca6a1c54fb7 (patch)
treed344f59144b61a383822fc09d120bf269630913f /sway/tree/container.c
parentcommands/move: fix crash when moving sphsc child (diff)
downloadsway-13a67da614449ec95d1dc1927ed7dca6a1c54fb7.tar.gz
sway-13a67da614449ec95d1dc1927ed7dca6a1c54fb7.tar.zst
sway-13a67da614449ec95d1dc1927ed7dca6a1c54fb7.zip
container: Fix NULL pointer dereference
Reset the workspace layout to the output's default only if the workspace is actually attached to an output. Fixes #5762
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index fe622c7b..3e234186 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1358,7 +1358,9 @@ void container_detach(struct sway_container *child) {
1358 // We may have removed the last tiling child from the workspace. If the 1358 // We may have removed the last tiling child from the workspace. If the
1359 // workspace layout was e.g. tabbed, then at this point it may be just 1359 // workspace layout was e.g. tabbed, then at this point it may be just
1360 // H[]. So, reset it to the default (e.g. T[]) for next time. 1360 // H[]. So, reset it to the default (e.g. T[]) for next time.
1361 if (!old_workspace->tiling->length) { 1361 // But if we are evacuating a workspace with only sticky floating
1362 // containers, the workspace will already be detached from the output.
1363 if (old_workspace->output && !old_workspace->tiling->length) {
1362 old_workspace->layout = 1364 old_workspace->layout =
1363 output_get_default_layout(old_workspace->output); 1365 output_get_default_layout(old_workspace->output);
1364 } 1366 }