fix shutdown+init cycle with deferred win free
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 10 Mar 2011 06:35:33 +0000 (06:35 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 10 Mar 2011 06:35:33 +0000 (06:35 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@57654 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_main.c
src/lib/elm_priv.h
src/lib/elm_win.c

index c8ca6b9..c1ab941 100644 (file)
@@ -360,6 +360,8 @@ elm_shutdown(void)
 {
    _elm_init_count--;
    if (_elm_init_count > 0) return _elm_init_count;
+   _elm_win_shutdown();
+   while (_elm_win_deferred_free) ecore_main_loop_iterate();
    elm_quicklaunch_sub_shutdown();
    elm_quicklaunch_shutdown();
    return _elm_init_count;
index b808f86..6932fda 100644 (file)
@@ -207,5 +207,6 @@ extern const char  *_elm_data_dir;
 extern const char  *_elm_lib_dir;
 extern int          _elm_log_dom;
 extern Eina_List   *_elm_win_list;
+extern int          _elm_win_deferred_free;
 
 #endif
index ac287d1..fa16fd8 100644 (file)
@@ -73,6 +73,7 @@ static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, cons
 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
 
 Eina_List *_elm_win_list = NULL;
+int _elm_win_deferred_free = 0;
 
 static void
 _elm_win_move(Ecore_Evas *ee)
@@ -198,6 +199,7 @@ static void
 _deferred_ecore_evas_free(void *data)
 {
    ecore_evas_free(data);
+   _elm_win_deferred_free--;
 }
 
 static void
@@ -246,7 +248,9 @@ _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void
 //   evas_font_cache_flush(win->evas);
 // FIXME: we are in the del handler for the object and delete the canvas
 // that lives under it from the handler... nasty. deferring doesn't help either
+
    ecore_job_add(_deferred_ecore_evas_free, win->ee);
+   _elm_win_deferred_free++;
 //   ecore_evas_free(win->ee);
 
    _elm_win_focus_highlight_shutdown(win);