From fa5626cf15f4a39e7999d2b24800c385a3d0c0c8 Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 2 Aug 2011 07:23:05 +0000 Subject: [PATCH] fix edje_shutdown being calle3d before all edje object are deleted - keep edje internal data around until all refs to edje are gone from objects, then shtudown the core. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@61984 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/edje_main.c | 39 +++++++++++++++++++++++++++++++-------- src/lib/edje_private.h | 3 +++ src/lib/edje_smart.c | 3 +++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/lib/edje_main.c b/src/lib/edje_main.c index 43069bd..5cc7b98 100644 --- a/src/lib/edje_main.c +++ b/src/lib/edje_main.c @@ -107,16 +107,12 @@ edje_init(void) return --_edje_init_count; } +static int _edje_users = 0; -EAPI int -edje_shutdown(void) +static void +_edje_shutdown_core(void) { - if (--_edje_init_count != 0) - return _edje_init_count; - - if (_edje_timer) - ecore_animator_del(_edje_timer); - _edje_timer = NULL; + if (_edje_users > 0) return; _edje_file_cache_shutdown(); _edje_color_class_members_free(); @@ -141,6 +137,33 @@ edje_shutdown(void) eina_log_domain_unregister(_edje_default_log_dom); _edje_default_log_dom = -1; eina_shutdown(); +} + +void +_edje_lib_ref(void) +{ + _edje_users++; +} + +void +_edje_lib_unref(void) +{ + _edje_users--; + if (_edje_users != 0) return; + if (_edje_init_count == 0) _edje_shutdown_core(); +} + +EAPI int +edje_shutdown(void) +{ + if (--_edje_init_count != 0) + return _edje_init_count; + + if (_edje_timer) + ecore_animator_del(_edje_timer); + _edje_timer = NULL; + + _edje_shutdown_core(); return _edje_init_count; } diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 985c82f..07a901e 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -1883,4 +1883,7 @@ const char *edje_string_id_get(const Edje_String *es); void _edje_object_orientation_inform(Evas_Object *obj); +void _edje_lib_ref(void); +void _edje_lib_unref(void); + #endif diff --git a/src/lib/edje_smart.c b/src/lib/edje_smart.c index 2b847e2..5d1440d 100644 --- a/src/lib/edje_smart.c +++ b/src/lib/edje_smart.c @@ -23,6 +23,8 @@ edje_object_add(Evas *evas) { Evas_Object *e; + _edje_lib_ref(); + if (!_edje_smart) { memset(&_edje_smart_parent, 0, sizeof(_edje_smart_parent)); @@ -150,6 +152,7 @@ _edje_smart_del(Evas_Object * obj) _edje_file_del(ed); _edje_clean_objects(ed); _edje_unref(ed); + _edje_lib_unref(); } static void -- 2.7.4