aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-03-31 13:47:22 -0400
committerLibravatar emersion <contact@emersion.fr>2018-03-31 13:47:22 -0400
commit8aedc042eeaa95a7a0be7c1dd06e3739ee1c7bd4 (patch)
tree407b0e53e843fd15a9e0a7bc92e75e25c6af3b9b
parentassert(fd != -1); (diff)
downloadsway-8aedc042eeaa95a7a0be7c1dd06e3739ee1c7bd4.tar.gz
sway-8aedc042eeaa95a7a0be7c1dd06e3739ee1c7bd4.tar.zst
sway-8aedc042eeaa95a7a0be7c1dd06e3739ee1c7bd4.zip
Fix two segfaults when destroying outputs
-rw-r--r--sway/desktop/layer_shell.c5
-rw-r--r--sway/tree/layout.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 5c96659a..c18f51c7 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -238,11 +238,12 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
238 wl_list_remove(&sway_layer->unmap.link); 238 wl_list_remove(&sway_layer->unmap.link);
239 wl_list_remove(&sway_layer->surface_commit.link); 239 wl_list_remove(&sway_layer->surface_commit.link);
240 if (sway_layer->layer_surface->output != NULL) { 240 if (sway_layer->layer_surface->output != NULL) {
241 struct sway_output *output = sway_layer->layer_surface->output->data;
242 arrange_layers(output);
243
241 wl_list_remove(&sway_layer->output_destroy.link); 244 wl_list_remove(&sway_layer->output_destroy.link);
242 } 245 }
243 struct sway_output *output = sway_layer->layer_surface->output->data;
244 free(sway_layer); 246 free(sway_layer);
245 arrange_layers(output);
246} 247}
247 248
248static void handle_map(struct wl_listener *listener, void *data) { 249static void handle_map(struct wl_listener *listener, void *data) {
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 588ceb2d..ce0682dc 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -107,7 +107,7 @@ struct sway_container *container_reap_empty(struct sway_container *container) {
107 return NULL; 107 return NULL;
108 } 108 }
109 wlr_log(L_DEBUG, "reaping %p %s", container, container->name); 109 wlr_log(L_DEBUG, "reaping %p %s", container, container->name);
110 while (container->children->length == 0) { 110 while (container != &root_container && container->children->length == 0) {
111 if (container->type == C_WORKSPACE) { 111 if (container->type == C_WORKSPACE) {
112 if (!workspace_is_visible(container)) { 112 if (!workspace_is_visible(container)) {
113 struct sway_container *parent = container->parent; 113 struct sway_container *parent = container->parent;