aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-08-31 23:19:47 +0300
committerDrew DeVault <sir@cmpwn.com>2019-09-01 09:58:03 +0900
commit53e01bf5c7763b5f49ce15b05f6b32f986e2b2ba (patch)
tree3eeb285b3f4bb0e434df4db66638cdf35ebf4945 /sway/desktop
parentb2ee5bc05d1f112e2f80a50749f91d58fc89b167 (diff)
layer-shell: don't give focus to unmapped layer surfaces
Focused layers are not cleared when destroyed, they are cleared on unmap. Giving focus to an unmapped layer surface is (1) incorrect and (2) triggers a use-after-free. Closes: https://github.com/swaywm/sway/issues/4517
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/layer_shell.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 60270a42..c881919d 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -200,7 +200,8 @@ void arrange_layers(struct sway_output *output) {
for (size_t i = 0; i < nlayers; ++i) {
wl_list_for_each_reverse(layer,
&output->layers[layers_above_shell[i]], link) {
- if (layer->layer_surface->current.keyboard_interactive) {
+ if (layer->layer_surface->current.keyboard_interactive &&
+ layer->layer_surface->mapped) {
topmost = layer;
break;
}