aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/root.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-04-02 13:17:01 -0400
committerLibravatar emersion <contact@emersion.fr>2019-04-03 19:45:17 +0300
commitf0f20f96aa5cea382ca079b6a88fbcaf5b3782ad (patch)
tree86ad935b1ecd5d77659c68523ec092a2c872745a /sway/tree/root.c
parentfix broken link to README.zh-CN.md (diff)
downloadsway-f0f20f96aa5cea382ca079b6a88fbcaf5b3782ad.tar.gz
sway-f0f20f96aa5cea382ca079b6a88fbcaf5b3782ad.tar.zst
sway-f0f20f96aa5cea382ca079b6a88fbcaf5b3782ad.zip
root_scratchpad_hide: fix crash when layer focused
This fixes a crash in `root_scratchpad_hide` when a layer surface is focused. Since `seat_get_focus` is NULL when a layer surface is focused, the call to `node_has_ancestor` was causing a SIGSEGV since it was attempting to access the parent of NULL. This changes the call to `seat_get_focus_inactive`, which will return a node even when a layer surface is focused and is also guaranteed to have something in the focus stack if a scratchpad container is being hidden (otherwise there would not be any containers yet).
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 3d93405e..c7c5e1df 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -135,7 +135,7 @@ void root_scratchpad_show(struct sway_container *con) {
135 135
136void root_scratchpad_hide(struct sway_container *con) { 136void root_scratchpad_hide(struct sway_container *con) {
137 struct sway_seat *seat = input_manager_current_seat(); 137 struct sway_seat *seat = input_manager_current_seat();
138 struct sway_node *focus = seat_get_focus(seat); 138 struct sway_node *focus = seat_get_focus_inactive(seat, &root->node);
139 struct sway_workspace *ws = con->workspace; 139 struct sway_workspace *ws = con->workspace;
140 140
141 container_detach(con); 141 container_detach(con);