summaryrefslogtreecommitdiff
path: root/ivi-shell/ivi-layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'ivi-shell/ivi-layout.c')
-rw-r--r--ivi-shell/ivi-layout.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index af84eb63..cb1b72b4 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -251,8 +251,20 @@ static void
add_link_to_surface(struct ivi_layout_layer *ivilayer,
struct link_layer *link_layer)
{
- wl_list_init(&link_layer->link_to_layer);
- wl_list_insert(&ivilayer->link_to_surface, &link_layer->link_to_layer);
+ struct link_layer *link = NULL;
+ int found = 0;
+
+ wl_list_for_each(link, &ivilayer->link_to_surface, link_to_layer) {
+ if (link == link_layer) {
+ found = 1;
+ break;
+ }
+ }
+
+ if (found == 0) {
+ wl_list_init(&link_layer->link_to_layer);
+ wl_list_insert(&ivilayer->link_to_surface, &link_layer->link_to_layer);
+ }
}
static void