From 50a7b2ec4c7b5de7976a43154d4980ece099152a Mon Sep 17 00:00:00 2001 From: englebass Date: Wed, 17 Dec 2008 08:04:42 +0000 Subject: [PATCH] Fix eina hash usage. When using eina hash we need to create the hash if it does not exist. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@38172 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/edje_script_only.c | 1 + src/lib/edje_util.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/edje_script_only.c b/src/lib/edje_script_only.c index 6bc2c43..e8835c4 100644 --- a/src/lib/edje_script_only.c +++ b/src/lib/edje_script_only.c @@ -153,6 +153,7 @@ _oid_track(Edje *ed, Evas_Object *o) evas_object_clip_set(oi->obj, oi->ed->clipper); evas_object_geometry_get(oi->obj, &(oi->x), &(oi->y), &(oi->w), &(oi->h)); snprintf(buf, sizeof(buf), "%i", oi->oid); + if (!si->oid.hash) si->oid.hash = eina_hash_string_superfast_new(NULL); eina_hash_add(si->oid.hash, buf, oi); return oi; } diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index aae8b03..37c8d18 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -298,6 +298,7 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2 free(cc); return; } + if (!_edje_color_class_hash) _edje_color_class_hash = eina_hash_string_superfast_new(NULL); eina_hash_add(_edje_color_class_hash, color_class, cc); } @@ -573,6 +574,7 @@ edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size siz free(tc); return; } + if (!_edje_text_class_hash) _edje_text_class_hash = eina_hash_string_superfast_new(NULL); eina_hash_add(_edje_text_class_hash, text_class, tc); tc->font = eina_stringshare_add(font); @@ -2514,6 +2516,7 @@ _edje_color_class_member_add(Edje *ed, const char *color_class) } members = eina_list_prepend(members, ed); + if (!_edje_color_class_member_hash) _edje_color_class_member_hash = eina_hash_string_superfast_new(NULL); eina_hash_add(_edje_color_class_member_hash, color_class, members); } @@ -2530,7 +2533,7 @@ _edje_color_class_member_del(Edje *ed, const char *color_class) members = eina_list_remove(members, ed); if (members) { - eina_hash_add(_edje_color_class_member_hash, color_class, members); + eina_hash_add(_edje_color_class_member_hash, color_class, members); } } @@ -2620,6 +2623,7 @@ _edje_text_class_member_add(Edje *ed, const char *text_class) members = eina_list_prepend(members, ed); /* Add the member list back */ + if (!_edje_text_class_member_hash) _edje_text_class_member_hash = eina_hash_string_superfast_new(NULL); eina_hash_add(_edje_text_class_member_hash, text_class, members); } -- 2.7.4