atspi: Demote relation object if the object exist 21/129721/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 17 May 2017 08:10:28 +0000 (17:10 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Thu, 18 May 2017 01:34:14 +0000 (10:34 +0900)
Change-Id: If49cc6c33228e168dbc0b6f22eeed5d7c5111a9a

src/lib/elm_interface_atspi_accessible.c

index 5bd8317..6a62a57 100644 (file)
@@ -604,7 +604,7 @@ EAPI Eina_Bool
 elm_atspi_relation_set_relation_append(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj)
 {
    Elm_Atspi_Relation *rel;
-   Eina_List *l;
+   Eina_List *l, *ll;
 
    if (!eo_isa(rel_obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
      return EINA_FALSE;
@@ -613,11 +613,16 @@ elm_atspi_relation_set_relation_append(Elm_Atspi_Relation_Set *set, Elm_Atspi_Re
      {
         if (rel->type == type)
           {
-             if (!eina_list_data_find(rel->objects, rel_obj))
+             ll = eina_list_data_find_list(rel->objects, rel_obj);
+             if (!ll)
                {
                   rel->objects = eina_list_append(rel->objects, rel_obj);
                   eo_do(rel_obj, eo_event_callback_add(EO_BASE_EVENT_DEL, _on_rel_obj_del, set));
                }
+             else
+               {
+                  rel->objects = eina_list_demote_list(rel->objects, ll);
+               }
              return EINA_TRUE;
           }
      }