entrance: delete the timer if the object is deleted

This commit is contained in:
Marcel Hollerbach 2014-05-31 15:03:25 +02:00
parent f626cb0a23
commit f266ddbc6a
1 changed files with 17 additions and 20 deletions

View File

@ -47,7 +47,6 @@ static Eina_Bool _entrance_tp_login_timer(void *data);
static void _entrance_tp_animation_reset(void *data);
static void _entrance_tp_animation_init(Entrance_Theme_Preview *l);
static Evas_Object* _entrance_tp_add(Evas_Object *par, const char *name);
static void _entrance_tp_del(Evas_Object *par);
static void
@ -66,7 +65,7 @@ _entrance_conf_theme_update_preview(const char *name)
o = elm_object_part_content_get(_entrance_int_conf_theme->preview, "default");
if (o)
_entrance_tp_del(o);
evas_object_del(o);
o = _entrance_tp_add(_entrance_int_conf_theme->preview, name);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -79,10 +78,6 @@ _entrance_conf_theme_update_preview(const char *name)
static void
_entrance_conf_theme_end(void)
{
Evas_Object *o;
o = elm_object_part_content_get(_entrance_int_conf_theme->preview, "default");
if (o)
_entrance_tp_del(o);
free(_entrance_int_conf_theme);
}
@ -398,6 +393,19 @@ bad_end:
return NULL;
}
static void
_entrance_tp_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Entrance_Theme_Preview *pre = evas_object_smart_data_get(obj);
String_Animation *ani;
if ((pre) && (pre->active_timer))
{
ani = ecore_timer_del(pre->active_timer);
free(ani);
}
}
static Evas_Object*
_entrance_tp_add(Evas_Object *par, const char *name)
{
@ -468,20 +476,9 @@ _entrance_tp_add(Evas_Object *par, const char *name)
_entrance_tp_animation_init(pre);
evas_object_smart_data_set(pre->transition, pre);
evas_object_event_callback_add(pre->transition, EVAS_CALLBACK_DEL, _entrance_tp_del_cb, NULL);
return pre->transition;
}
static void
_entrance_tp_del(Evas_Object *obj)
{
Entrance_Theme_Preview *pre = evas_object_smart_data_get(obj);
String_Animation *ani;
if ((pre) && pre->active_timer)
{
ani = ecore_timer_del(pre->active_timer);
free(ani);
}
evas_object_del(obj);
}