mirror of
https://github.com/NickHu/sway
synced 2024-12-28 22:23:30 +01:00
Assert output is found before removing from list
References: https://github.com/swaywm/sway/issues/5483
This commit is contained in:
parent
39d677af15
commit
9bb70283e9
1 changed files with 5 additions and 1 deletions
|
@ -251,6 +251,11 @@ void output_disable(struct sway_output *output) {
|
||||||
if (!sway_assert(output->enabled, "Expected an enabled output")) {
|
if (!sway_assert(output->enabled, "Expected an enabled output")) {
|
||||||
return;
|
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);
|
sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
|
||||||
wl_signal_emit(&output->events.destroy, output);
|
wl_signal_emit(&output->events.destroy, output);
|
||||||
|
|
||||||
|
@ -258,7 +263,6 @@ void output_disable(struct sway_output *output) {
|
||||||
|
|
||||||
root_for_each_container(untrack_output, output);
|
root_for_each_container(untrack_output, output);
|
||||||
|
|
||||||
int index = list_find(root->outputs, output);
|
|
||||||
list_del(root->outputs, index);
|
list_del(root->outputs, index);
|
||||||
|
|
||||||
output->enabled = false;
|
output->enabled = false;
|
||||||
|
|
Loading…
Reference in a new issue