From ab51c95d2122c15ecfd28e3886406ce2024f60e7 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 2 Apr 2019 12:30:45 -0700 Subject: [PATCH] elementary: add a queue to postpone object destruction when necessary. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8540 --- src/lib/elementary/elm_main.c | 17 +++++++++++++++++ src/lib/elementary/elm_priv.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 7f5d16f26d..ad2cd535d1 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -46,6 +46,8 @@ static void * _accessibility_currently_highlighted_obj = NULL; // 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) { @@ -790,6 +792,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) @@ -801,6 +809,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); @@ -847,6 +857,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) @@ -981,6 +993,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(); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 9188c1a433..8a33cdc8d6 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -938,6 +938,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 -- 2.34.1