From 59c4e0f81ba47dee3c352b0b0ae74e47fe3d0bb2 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 26 Apr 2013 16:21:37 +0900 Subject: [PATCH] fix race condtion in comp caused by delayed job doing the populate. by making a job to delay population we play a race condition game with initting of other bits of e. this means the comp may or may not have been filled by the container layer winds before other internal events and actions start making comp wins and setting layers. this means that things like e_comp_win_find() for a con->layers[n].win may fail... as this has yet to be added... and thus.. we crash in startup. it's a race condition. so this removed the delay job and makes population of the comp explicit. it puts the population into the hnds of the e_main init after a manager has been created and after a container is created, and thus laer wins created, so it can walk the x window stack correctly, but before anything else is done. this means that we will be properly inited at this point without a race condition. --- src/bin/e_comp.c | 9 ++++++--- src/bin/e_comp.h | 1 + src/bin/e_main.c | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index bb57f4b4a..4ced3ce77 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -4215,9 +4215,6 @@ _e_comp_add(E_Manager *man) ecore_x_composite_redirect_subwindows (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL); - /* ensure we're in main loop so managers and containers have been set up */ - ecore_job_add((Ecore_Cb)_e_comp_populate, c); - ecore_x_window_key_grab(c->man->root, "Home", ECORE_EVENT_MODIFIER_SHIFT | ECORE_EVENT_MODIFIER_CTRL | ECORE_EVENT_MODIFIER_ALT, 0); @@ -4228,6 +4225,12 @@ _e_comp_add(E_Manager *man) return c; } +EAPI void +e_comp_populate(E_Comp *c) +{ + _e_comp_populate(c); +} + static void _e_comp_del(E_Comp *c) { diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h index ae337a2e7..baed8db69 100644 --- a/src/bin/e_comp.h +++ b/src/bin/e_comp.h @@ -248,6 +248,7 @@ EAPI void e_comp_win_hidden_set(E_Comp_Win *cw, Eina_Bool hidden); EAPI void e_comp_win_opacity_set(E_Comp_Win *cw, unsigned int opacity); EAPI E_Comp *e_comp_get(void *o); +EAPI void e_comp_populate(E_Comp *c); EAPI Ecore_X_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y, Ecore_X_Window *ignore, unsigned int ignore_num); diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 005d9564b..dd22da182 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1717,6 +1717,7 @@ _e_main_screens_init(void) con = e_container_new(man); if (con) { + e_comp_populate(man->comp); e_container_show(con); e_grabinput_focus(con->bg_win, E_FOCUS_METHOD_PASSIVE); e_hints_manager_init(man);