protect against failure to find a container layer win in comp
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 26 Apr 2013 07:28:27 +0000 (16:28 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 26 Apr 2013 07:31:29 +0000 (16:31 +0900)
it may happen that a container layer window cannot be found (someone
deleted it other than e - which is possible), and e hasn't expected
this. comp will have removed the comp win entry but containers will
not know. this is either some client being stupid, or malicious, but
protect against it, complain with an ERR and march on so we don't crash.

src/bin/e_comp.c

index 4ced3ce..cde8c6c 100644 (file)
@@ -5388,10 +5388,18 @@ e_comp_canvas_layer_set(Evas_Object *obj, E_Comp_Canvas_Layer comp_layer, E_Laye
 
              con = eina_list_data_get(c->man->containers);
              cwn = e_comp_win_find(con->layers[0].win);
-             cwn->stack_below = eina_list_append(cwn->stack_below, cw);
-             cw->cw_above = cwn;
-             c->wins = eina_inlist_remove(c->wins, EINA_INLIST_GET(cw));
-             c->wins = eina_inlist_prepend_relative(c->wins, EINA_INLIST_GET(cw), EINA_INLIST_GET(cwn));
+             if (!cwn)
+               {
+                  ERR("Major error. Cannot find container layer 0 window marker");
+                  c->wins = eina_inlist_prepend(c->wins, EINA_INLIST_GET(cw));
+               }
+             else
+               {
+                  cwn->stack_below = eina_list_append(cwn->stack_below, cw);
+                  cw->cw_above = cwn;
+                  c->wins = eina_inlist_remove(c->wins, EINA_INLIST_GET(cw));
+                  c->wins = eina_inlist_prepend_relative(c->wins, EINA_INLIST_GET(cw), EINA_INLIST_GET(cwn));
+               }
           }
      }
    if (stack == E_COMP_CANVAS_STACK_ABOVE)