diff options
author | Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> | 2014-06-03 14:58:00 +0900 |
---|---|---|
committer | Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> | 2014-06-03 18:02:09 +0900 |
commit | 282ebdc0c6ac803b0f839b02779cd52ae9d9b3e7 (patch) | |
tree | 4a44d475e10d544cf8b4f2975f49b0989f149817 | |
parent | c8709585cb7b37a0c5498a8762f6d08c96b7f47d (diff) | |
download | weston-282ebdc0c6ac803b0f839b02779cd52ae9d9b3e7.tar.gz |
Avoid insertion of link_layer duplicate.
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
-rw-r--r-- | ivi-shell/ivi-layout.c | 16 |
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 |