aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-10-08 11:16:39 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-10-08 11:18:11 -0400
commit291431c14f5e5c33c14a6fff4284c3de03ff292c (patch)
tree08436061ddd3629fbd9beb804075fb2e62df56e7
parent96690d638019e9bf3f275f9e17eb1bb26d47eebe (diff)
scene/output_layout: Add assert for duplicate output insertion
Ensure that the output was not added multiple times to the scene output layout.
-rw-r--r--types/scene/output_layout.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/types/scene/output_layout.c b/types/scene/output_layout.c
index ffe0d3ec..42683f88 100644
--- a/types/scene/output_layout.c
+++ b/types/scene/output_layout.c
@@ -73,7 +73,12 @@ void wlr_scene_output_layout_add_output(struct wlr_scene_output_layout *sol,
struct wlr_output_layout_output *lo, struct wlr_scene_output *so) {
assert(lo->output == so->output);
- struct wlr_scene_output_layout_output *solo = calloc(1, sizeof(*solo));
+ struct wlr_scene_output_layout_output *solo;
+ wl_list_for_each(solo, &sol->outputs, link) {
+ assert(solo->scene_output != so);
+ }
+
+ solo = calloc(1, sizeof(*solo));
if (solo == NULL) {
return;
}