fix race condtion in comp caused by delayed job doing the populate.
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 26 Apr 2013 07:21:37 +0000 (16:21 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 26 Apr 2013 07:31:29 +0000 (16:31 +0900)
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
src/bin/e_comp.h
src/bin/e_main.c

index bb57f4b..4ced3ce 100644 (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)
 {
index ae337a2..baed8db 100644 (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);
 
index 005d956..dd22da1 100644 (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);