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)
downloadefl-431800a529fba3ff90c77cfdb3cd76e79c59528a.tar.gz
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
{
Efl_Time time;
char format[MAX_FORMAT_LEN];
+ Eina_Bool init;
} Efl_Datetime_Manager_Data;
-Eina_Bool init = EINA_FALSE;
-
static void
_time_init(Efl_Time *curr_time)
{
@@ -33,8 +32,6 @@ _time_init(Efl_Time *curr_time)
t = time(NULL);
localtime_r(&t, curr_time);
-
- init = EINA_TRUE;
}
static char *
@@ -162,7 +159,8 @@ _efl_datetime_manager_value_set(Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *
EOLIAN static Efl_Time
_efl_datetime_manager_value_get(const Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *pd)
{
- if (!init) _time_init(&pd->time);
+ if (!pd->init) _time_init(&pd->time);
+ pd->init = EINA_TRUE;
return pd->time;
}
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)
}
EFL_END_TEST
+
+EFL_START_TEST(no_err_on_creation)
+{
+ widget = efl_add(widget_klass, win);
+}
+EFL_END_TEST
+
EFL_START_TEST(no_err_on_shutdown)
{
efl_ref(widget);
@@ -204,4 +211,5 @@ efl_ui_widget_behavior_test(TCase *tc)
tcase_add_test(tc, no_leaking_canvas_object);
tcase_add_test(tc, no_err_on_shutdown);
tcase_add_test(tc, correct_visibility_setting);
+ tcase_add_test(tc, no_err_on_creation);
}