Skip to content

Commit

Permalink
Assert output is found before removing from list
Browse files Browse the repository at this point in the history
References: swaywm#5483
  • Loading branch information
emersion committed Jul 13, 2020
1 parent 39d677a commit ea98f4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sway/tree/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,18 @@ void output_disable(struct sway_output *output) {
if (!sway_assert(output->enabled, "Expected an enabled output")) {
return;
}
int index = list_find(root->outputs, output);
if (!sway_assert(index >= 0, "Output not found in root node")) {
return;
}

sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
wl_signal_emit(&output->events.destroy, output);

output_evacuate(output);

root_for_each_container(untrack_output, output);

int index = list_find(root->outputs, output);
list_del(root->outputs, index);

output->enabled = false;
Expand Down

0 comments on commit ea98f4c

Please sign in to comment.