summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-09 19:25:18 +0100
committerCedric BAIL <cedric.bail@free.fr>2019-12-13 09:33:01 -0800
commit431800a529fba3ff90c77cfdb3cd76e79c59528a (patch)
tree37591d82b5cb988fb4961b33298a751f6fde0b14
parente0ab85cff942f2ca8b2c2882661439641d02e032 (diff)
efl_datetime_manager: how did that ever work?
seriously, it sometimes might be worth at least *reading* what code does, this was initializating a private data struct on one single global boolean flag. How was that ever intended to work ? How could that ever slip through review ? This is not the only madness in these widget arround time and date, you cannot even select hours in 24h mode, you also cannot cannot select the 0 hour, which is kind of normal for the one or another region? the datetimemanager (which is IMO a complete misconcept) is full of FIXMEs and API calls that are defined and never called at all. Again what is this ? And how did that ever get into the codebase ?! With this commit the widget *finally* can be created more than once without exploding and erroring one. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10843
-rw-r--r--src/lib/elementary/efl_datetime_manager.c8
-rw-r--r--src/tests/elementary/spec/efl_test_basics.c8
2 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/elementary/efl_datetime_manager.c b/src/lib/elementary/efl_datetime_manager.c
index 24daa34217..7445b8cdee 100644
--- a/src/lib/elementary/efl_datetime_manager.c
+++ b/src/lib/elementary/efl_datetime_manager.c
@@ -22,10 +22,9 @@ typedef struct
22{ 22{
23 Efl_Time time; 23 Efl_Time time;
24 char format[MAX_FORMAT_LEN]; 24 char format[MAX_FORMAT_LEN];
25 Eina_Bool init;
25} Efl_Datetime_Manager_Data; 26} Efl_Datetime_Manager_Data;
26 27
27Eina_Bool init = EINA_FALSE;
28
29static void 28static void
30_time_init(Efl_Time *curr_time) 29_time_init(Efl_Time *curr_time)
31{ 30{
@@ -33,8 +32,6 @@ _time_init(Efl_Time *curr_time)
33 32
34 t = time(NULL); 33 t = time(NULL);
35 localtime_r(&t, curr_time); 34 localtime_r(&t, curr_time);
36
37 init = EINA_TRUE;
38} 35}
39 36
40static char * 37static char *
@@ -162,7 +159,8 @@ _efl_datetime_manager_value_set(Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *
162EOLIAN static Efl_Time 159EOLIAN static Efl_Time
163_efl_datetime_manager_value_get(const Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *pd) 160_efl_datetime_manager_value_get(const Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *pd)
164{ 161{
165 if (!init) _time_init(&pd->time); 162 if (!pd->init) _time_init(&pd->time);
163 pd->init = EINA_TRUE;
166 164
167 return pd->time; 165 return pd->time;
168} 166}
diff --git a/src/tests/elementary/spec/efl_test_basics.c b/src/tests/elementary/spec/efl_test_basics.c
index 99a441c059..b14e18a568 100644
--- a/src/tests/elementary/spec/efl_test_basics.c
+++ b/src/tests/elementary/spec/efl_test_basics.c
@@ -124,6 +124,13 @@ EFL_START_TEST(no_leaking_canvas_object)
124} 124}
125EFL_END_TEST 125EFL_END_TEST
126 126
127
128EFL_START_TEST(no_err_on_creation)
129{
130 widget = efl_add(widget_klass, win);
131}
132EFL_END_TEST
133
127EFL_START_TEST(no_err_on_shutdown) 134EFL_START_TEST(no_err_on_shutdown)
128{ 135{
129 efl_ref(widget); 136 efl_ref(widget);
@@ -204,4 +211,5 @@ efl_ui_widget_behavior_test(TCase *tc)
204 tcase_add_test(tc, no_leaking_canvas_object); 211 tcase_add_test(tc, no_leaking_canvas_object);
205 tcase_add_test(tc, no_err_on_shutdown); 212 tcase_add_test(tc, no_err_on_shutdown);
206 tcase_add_test(tc, correct_visibility_setting); 213 tcase_add_test(tc, correct_visibility_setting);
214 tcase_add_test(tc, no_err_on_creation);
207} 215}