diff options
author | Ronan Pigott <rpigott@berkeley.edu> | 2020-01-14 17:08:01 -0700 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-01-16 21:48:25 -0500 |
commit | d88d4bbd9d363435a4d65191446a497de9031cca (patch) | |
tree | 369c3bf76bea3013dc08a6796e1ca7225216dc0d /sway/tree | |
parent | desktop/output: fix mem leak in handle_new_output (diff) | |
download | sway-d88d4bbd9d363435a4d65191446a497de9031cca.tar.gz sway-d88d4bbd9d363435a4d65191446a497de9031cca.tar.zst sway-d88d4bbd9d363435a4d65191446a497de9031cca.zip |
Fix crash when showing scratchpad hidden split containers
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 7 | ||||
-rw-r--r-- | sway/tree/root.c | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index aa819be7..56cdee1d 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1527,3 +1527,10 @@ void container_raise_floating(struct sway_container *con) { | |||
1527 | bool container_is_scratchpad_hidden(struct sway_container *con) { | 1527 | bool container_is_scratchpad_hidden(struct sway_container *con) { |
1528 | return con->scratchpad && !con->workspace; | 1528 | return con->scratchpad && !con->workspace; |
1529 | } | 1529 | } |
1530 | |||
1531 | bool container_is_scratchpad_hidden_or_child(struct sway_container *con) { | ||
1532 | while (con->parent) { | ||
1533 | con = con->parent; | ||
1534 | } | ||
1535 | return con->scratchpad && !con->workspace; | ||
1536 | } | ||
diff --git a/sway/tree/root.c b/sway/tree/root.c index 46a140ef..ebd185ec 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -132,6 +132,11 @@ void root_scratchpad_show(struct sway_container *con) { | |||
132 | if (old_ws) { | 132 | if (old_ws) { |
133 | container_detach(con); | 133 | container_detach(con); |
134 | workspace_consider_destroy(old_ws); | 134 | workspace_consider_destroy(old_ws); |
135 | } else { | ||
136 | // Act on the ancestor of scratchpad hidden split containers | ||
137 | while (con->parent) { | ||
138 | con = con->parent; | ||
139 | } | ||
135 | } | 140 | } |
136 | workspace_add_floating(new_ws, con); | 141 | workspace_add_floating(new_ws, con); |
137 | 142 | ||