diff options
author | Simon Ser <contact@emersion.fr> | 2020-07-12 16:50:11 +0200 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-07-13 17:33:54 -0400 |
commit | 9bb70283e967037e6d57bc863ef96d3b5185a989 (patch) | |
tree | 9bcfab4d539562acca0c55f9931442bf31cc3204 | |
parent | input: implement xdg_toplevel interactive resize hints (diff) | |
download | sway-9bb70283e967037e6d57bc863ef96d3b5185a989.tar.gz sway-9bb70283e967037e6d57bc863ef96d3b5185a989.tar.zst sway-9bb70283e967037e6d57bc863ef96d3b5185a989.zip |
Assert output is found before removing from list
References: https://github.com/swaywm/sway/issues/5483
-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) { | |||
251 | if (!sway_assert(output->enabled, "Expected an enabled output")) { | 251 | if (!sway_assert(output->enabled, "Expected an enabled output")) { |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | int index = list_find(root->outputs, output); | ||
255 | if (!sway_assert(index >= 0, "Output not found in root node")) { | ||
256 | return; | ||
257 | } | ||
258 | |||
254 | sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name); | 259 | sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name); |
255 | wl_signal_emit(&output->events.destroy, output); | 260 | wl_signal_emit(&output->events.destroy, output); |
256 | 261 | ||
@@ -258,7 +263,6 @@ void output_disable(struct sway_output *output) { | |||
258 | 263 | ||
259 | root_for_each_container(untrack_output, output); | 264 | root_for_each_container(untrack_output, output); |
260 | 265 | ||
261 | int index = list_find(root->outputs, output); | ||
262 | list_del(root->outputs, index); | 266 | list_del(root->outputs, index); |
263 | 267 | ||
264 | output->enabled = false; | 268 | output->enabled = false; |