diff options
author | db <github@benedik.si> | 2018-05-01 17:38:55 +0200 |
---|---|---|
committer | db <github@benedik.si> | 2018-05-01 19:05:32 +0200 |
commit | 22170bde77a92126ab5c183604634bbb2b89a10a (patch) | |
tree | 926b0553f47eb786dc0c40ab99d2d56ebc64c66b /sway/desktop/layer_shell.c | |
parent | Merge pull request #1874 from RyanDwyer/borders (diff) | |
download | sway-22170bde77a92126ab5c183604634bbb2b89a10a.tar.gz sway-22170bde77a92126ab5c183604634bbb2b89a10a.tar.zst sway-22170bde77a92126ab5c183604634bbb2b89a10a.zip |
Fix layer surface crash on output destroy
Before freeing sway_output, NULL the wlr_output reference to it. Check for that
NULL in layer_shell handle_destroy. Don't damage null container in unmap.
Additionaly, terminate swaybg if its output is being disabled.
Diffstat (limited to 'sway/desktop/layer_shell.c')
-rw-r--r-- | sway/desktop/layer_shell.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 03419ac1..c904880d 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -255,6 +255,9 @@ static void unmap(struct sway_layer_surface *sway_layer) { | |||
255 | return; | 255 | return; |
256 | } | 256 | } |
257 | struct sway_output *output = wlr_output->data; | 257 | struct sway_output *output = wlr_output->data; |
258 | if (output == NULL) { | ||
259 | return; | ||
260 | } | ||
258 | output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, | 261 | output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, |
259 | sway_layer->layer_surface->surface, true); | 262 | sway_layer->layer_surface->surface, true); |
260 | } | 263 | } |
@@ -274,9 +277,11 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
274 | wl_list_remove(&sway_layer->surface_commit.link); | 277 | wl_list_remove(&sway_layer->surface_commit.link); |
275 | if (sway_layer->layer_surface->output != NULL) { | 278 | if (sway_layer->layer_surface->output != NULL) { |
276 | struct sway_output *output = sway_layer->layer_surface->output->data; | 279 | struct sway_output *output = sway_layer->layer_surface->output->data; |
277 | arrange_layers(output); | 280 | if (output != NULL) { |
278 | 281 | arrange_layers(output); | |
282 | } | ||
279 | wl_list_remove(&sway_layer->output_destroy.link); | 283 | wl_list_remove(&sway_layer->output_destroy.link); |
284 | sway_layer->layer_surface->output = NULL; | ||
280 | } | 285 | } |
281 | free(sway_layer); | 286 | free(sway_layer); |
282 | } | 287 | } |