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.
This commit is contained in:
Carsten Haitzler 2013-04-26 16:21:37 +09:00
parent 61aa5a29c2
commit 59c4e0f81b
3 changed files with 8 additions and 3 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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);