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
This commit is contained in:
parent
e0ab85cff9
commit
431800a529
|
@ -22,10 +22,9 @@ typedef struct
|
||||||
{
|
{
|
||||||
Efl_Time time;
|
Efl_Time time;
|
||||||
char format[MAX_FORMAT_LEN];
|
char format[MAX_FORMAT_LEN];
|
||||||
|
Eina_Bool init;
|
||||||
} Efl_Datetime_Manager_Data;
|
} Efl_Datetime_Manager_Data;
|
||||||
|
|
||||||
Eina_Bool init = EINA_FALSE;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_time_init(Efl_Time *curr_time)
|
_time_init(Efl_Time *curr_time)
|
||||||
{
|
{
|
||||||
|
@ -33,8 +32,6 @@ _time_init(Efl_Time *curr_time)
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
localtime_r(&t, curr_time);
|
localtime_r(&t, curr_time);
|
||||||
|
|
||||||
init = EINA_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -162,7 +159,8 @@ _efl_datetime_manager_value_set(Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *
|
||||||
EOLIAN static Efl_Time
|
EOLIAN static Efl_Time
|
||||||
_efl_datetime_manager_value_get(const Eo *obj EINA_UNUSED, Efl_Datetime_Manager_Data *pd)
|
_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;
|
return pd->time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,13 @@ EFL_START_TEST(no_leaking_canvas_object)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
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_START_TEST(no_err_on_shutdown)
|
||||||
{
|
{
|
||||||
efl_ref(widget);
|
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_leaking_canvas_object);
|
||||||
tcase_add_test(tc, no_err_on_shutdown);
|
tcase_add_test(tc, no_err_on_shutdown);
|
||||||
tcase_add_test(tc, correct_visibility_setting);
|
tcase_add_test(tc, correct_visibility_setting);
|
||||||
|
tcase_add_test(tc, no_err_on_creation);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue