summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2020-01-16 21:26:15 -0500
committerDrew DeVault <sir@cmpwn.com>2020-01-22 13:30:52 -0500
commit0bc8d01b1c3f549f5e77a5c764cf592acb587aad (patch)
treed527e132c901b6269d857980914f948f01b6f952
parent162743da8567ad8b801b1d24eff7c19c847bb618 (diff)
output: apply oc to outputs using wl_for_each_safe
If applying an output config to an output fails, the output may be destroyed. To be able to handle this situation correctly, apply_output_config_to_outputs needs to use wl_list_for_each_safe.
-rw-r--r--sway/config/output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index 8ea6c9f45..ec21b5127 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -550,8 +550,8 @@ void apply_output_config_to_outputs(struct output_config *oc) {
// will be applied during normal "new output" event from wlroots.
bool wildcard = strcmp(oc->name, "*") == 0;
char id[128];
- struct sway_output *sway_output;
- wl_list_for_each(sway_output, &root->all_outputs, link) {
+ struct sway_output *sway_output, *tmp;
+ wl_list_for_each_safe(sway_output, tmp, &root->all_outputs, link) {
char *name = sway_output->wlr_output->name;
output_get_identifier(id, sizeof(id), sway_output);
if (wildcard || !strcmp(name, oc->name) || !strcmp(id, oc->name)) {