Merge pull request #1689 from emersion/destroy-output-segfaults

Fix two segfaults when destroying outputs
This commit is contained in:
Drew DeVault 2018-03-31 15:17:32 -04:00 committed by GitHub
commit 543081ab1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -238,11 +238,12 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&sway_layer->unmap.link); wl_list_remove(&sway_layer->unmap.link);
wl_list_remove(&sway_layer->surface_commit.link); wl_list_remove(&sway_layer->surface_commit.link);
if (sway_layer->layer_surface->output != NULL) { if (sway_layer->layer_surface->output != NULL) {
struct sway_output *output = sway_layer->layer_surface->output->data;
arrange_layers(output);
wl_list_remove(&sway_layer->output_destroy.link); wl_list_remove(&sway_layer->output_destroy.link);
} }
struct sway_output *output = sway_layer->layer_surface->output->data;
free(sway_layer); free(sway_layer);
arrange_layers(output);
} }
static void handle_map(struct wl_listener *listener, void *data) { static void handle_map(struct wl_listener *listener, void *data) {

View file

@ -107,7 +107,7 @@ struct sway_container *container_reap_empty(struct sway_container *container) {
return NULL; return NULL;
} }
wlr_log(L_DEBUG, "reaping %p %s", container, container->name); wlr_log(L_DEBUG, "reaping %p %s", container, container->name);
while (container->children->length == 0) { while (container != &root_container && container->children->length == 0) {
if (container->type == C_WORKSPACE) { if (container->type == C_WORKSPACE) {
if (!workspace_is_visible(container)) { if (!workspace_is_visible(container)) {
struct sway_container *parent = container->parent; struct sway_container *parent = container->parent;