diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2020-07-12 16:50:11 +0200 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2020-07-12 16:50:11 +0200 |
| commit | 3bce86b9db458f30fd90ca2556d4821bad54707a (patch) | |
| tree | a11c40a1cc1b62877b28518f6c2b61fa7f7afee1 | |
| parent | 04e0da8f10f4a6ba0e3e8b13f18bed7f80ebb5fe (diff) | |
Assert output is found before removing from list
References: https://github.com/swaywm/sway/issues/5483
(cherry picked from commit 9bb70283e967037e6d57bc863ef96d3b5185a989)
| -rw-r--r-- | sway/tree/output.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c index ae3c3abf..d600c5c3 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -251,6 +251,11 @@ 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); @@ -258,7 +263,6 @@ void output_disable(struct sway_output *output) { root_for_each_container(untrack_output, output); - int index = list_find(root->outputs, output); list_del(root->outputs, index); output->enabled = false; |
