forked from enlightenment/efl
evas: handle object names with a list hash
a canvas can have multiple objects with the same name. assuming that name:obj is a 1:1 ratio means that name-finding functions are likely to return invalid objects @fix
This commit is contained in:
parent
1f555c897e
commit
5a9df96d9c
|
@ -221,7 +221,7 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
|
|||
e->framespace.h = 0;
|
||||
e->hinting = EVAS_FONT_HINTING_BYTECODE;
|
||||
e->current_event = EVAS_CALLBACK_LAST;
|
||||
e->name_hash = eina_hash_string_superfast_new(NULL);
|
||||
e->name_hash = eina_hash_string_superfast_new((Eina_Free_Cb)eina_list_free);
|
||||
eina_clist_init(&e->calc_list);
|
||||
eina_clist_init(&e->calc_done);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ evas_object_name_set(Evas_Object *eo_obj, const char *name)
|
|||
if (obj->name)
|
||||
{
|
||||
if (obj->layer && obj->layer->evas && obj->layer->evas->name_hash)
|
||||
eina_hash_del(obj->layer->evas->name_hash, obj->name, eo_obj);
|
||||
eina_hash_list_remove(obj->layer->evas->name_hash, obj->name, eo_obj);
|
||||
free(obj->name);
|
||||
}
|
||||
if (!name) obj->name = NULL;
|
||||
|
@ -18,7 +18,7 @@ evas_object_name_set(Evas_Object *eo_obj, const char *name)
|
|||
{
|
||||
obj->name = strdup(name);
|
||||
if (obj->layer && obj->layer->evas && obj->layer->evas->name_hash)
|
||||
eina_hash_add(obj->layer->evas->name_hash, obj->name, eo_obj);
|
||||
eina_hash_list_prepend(obj->layer->evas->name_hash, obj->name, eo_obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ EOLIAN Evas_Object*
|
|||
_evas_canvas_object_name_find(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const char *name)
|
||||
{
|
||||
if (!name) return NULL;
|
||||
else return (Evas_Object *)eina_hash_find(e->name_hash, name);
|
||||
else return eina_list_data_get(eina_hash_find(e->name_hash, name));
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
|
|
Loading…
Reference in New Issue