zmike pushed a commit to branch efl-1.22.

http://git.enlightenment.org/core/efl.git/commit/?id=568e1db5504743735dd5117f591603eb80ead5ca

commit 568e1db5504743735dd5117f591603eb80ead5ca
Author: Cedric BAIL <cedric.b...@free.fr>
Date:   Tue Apr 2 12:30:45 2019 -0700

    elementary: add a queue to postpone object destruction when necessary.
    
    Reviewed-by: Marcel Hollerbach <m...@marcel-hollerbach.de>
    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 676f1a9e8a..f3438364e3 100644
--- a/src/lib/elementary/elm_main.c
+++ b/src/lib/elementary/elm_main.c
@@ -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();
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index fa262e2646..b91effed8d 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -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

-- 


Reply via email to