elementary: add a queue to postpone object destruction when necessary.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8540
This commit is contained in:
Cedric BAIL 2019-04-02 12:30:45 -07:00 committed by Mike Blumenkrantz
parent f836dd0c22
commit 568e1db550
2 changed files with 19 additions and 0 deletions

View File

@ -43,6 +43,8 @@ Eina_Bool _use_build_config;
static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
EAPI Elm_Version *elm_version = &_version;
Eina_FreeQ *postponed_fq = NULL;
static void
_focus_ev_redirect_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
@ -755,6 +757,12 @@ elm_quicklaunch_mode_get(void)
return quicklaunch_on;
}
static void
_postpone_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
eina_freeq_clear(postponed_fq);
}
EAPI int
elm_quicklaunch_init(int argc EINA_UNUSED,
char **argv)
@ -766,6 +774,8 @@ elm_quicklaunch_init(int argc EINA_UNUSED,
_elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
EINA_SAFETY_ON_TRUE_GOTO(_elm_log_dom < 0, fail_eina_log);
postponed_fq = eina_freeq_new(EINA_FREEQ_POSTPONED);
EINA_SAFETY_ON_FALSE_GOTO(eet_init(), fail_eet);
EINA_SAFETY_ON_FALSE_GOTO(ecore_init(), fail_ecore);
EINA_SAFETY_ON_FALSE_GOTO(ecore_event_init(), fail_ecore_event);
@ -812,6 +822,8 @@ elm_quicklaunch_init(int argc EINA_UNUSED,
if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
if (!_property_style_ss) _property_style_ss = eina_stringshare_add("style");
efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL);
eina_log_timing(_elm_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
if (quicklaunch_on)
@ -946,6 +958,11 @@ elm_quicklaunch_shutdown(void)
emap_shutdown();
#endif
efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL);
eina_freeq_free(postponed_fq);
postponed_fq = NULL;
ecore_file_shutdown();
eio_shutdown();
ecore_event_shutdown();

View File

@ -905,6 +905,8 @@ extern Eina_Stringshare *_property_style_ss;
extern Eina_Bool _config_profile_lock;
extern Eina_FreeQ *postponed_fq;
# ifdef HAVE_ELEMENTARY_WL2
extern Ecore_Wl2_Display *_elm_wl_display;
# endif