summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-05-30 23:52:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-05-31 15:41:20 +0900
commit2b57acda336ae0ffc8e8eb427fcd754248d2276d (patch)
tree62288391637982aad076da9f29dfdcaf2c2e940b
parentf767e8bea4b817ca900221d98b432f28488d07a9 (diff)
downloadefl-2b57acda336ae0ffc8e8eb427fcd754248d2276d.tar.gz
test: Cleanup timer when window is closed
This avoids confusing ERR messages in efl_part().
-rw-r--r--src/bin/elementary/test_external.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bin/elementary/test_external.c b/src/bin/elementary/test_external.c
index 616fbaeb3f..b805c9a20d 100644
--- a/src/bin/elementary/test_external.c
+++ b/src/bin/elementary/test_external.c
@@ -64,6 +64,12 @@ test_external_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
evas_object_show(win);
}
+static void
+_timer_del(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ Ecore_Timer *t = data;
+ ecore_timer_del(t);
+}
static Eina_Bool
_timer_cb(void *data)
@@ -72,6 +78,7 @@ _timer_cb(void *data)
Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb5;
Edje_External_Param param;
double progress;
+ Ecore_Timer *t;
Eina_Value v;
pb1 = edje_object_part_external_object_get(edje, "ext_pbar1");
@@ -126,6 +133,10 @@ _timer_cb(void *data)
param.i = EINA_FALSE;
edje_object_part_external_param_set(edje, "ext_pbar7", &param);
+ t = efl_key_data_get(edje, "timer");
+ efl_event_callback_del(edje, EFL_EVENT_DEL, _timer_del, t);
+ efl_key_data_set(edje, "timer", NULL);
+
return ECORE_CALLBACK_CANCEL;
}
@@ -136,6 +147,7 @@ _bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb3, *pb5;
Edje_External_Param param;
Eina_Value v;
+ Ecore_Timer *t;
/* Test direct API calls on embedded objects */
bt1 = edje_object_part_external_object_get(edje, "ext_button1");
@@ -176,7 +188,9 @@ _bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
/* Test EO API for direct function calls */
efl_ui_progress_value_set(efl_part(edje, "ext_pbar3"), 0.0);
- ecore_timer_add(0.1, _timer_cb, edje);
+ t = ecore_timer_add(0.1, _timer_cb, edje);
+ efl_key_data_set(edje, "timer", t);
+ efl_event_callback_add(edje, EFL_EVENT_DEL, _timer_del, t);
}
void