the parent.
When we insert object inside a smart object, they could be attached to
another layer. As long as ref counting work, nothing wrong will happen.
But during destruction of an Evas, we were just looping over all layers,
destroying each of them, without checking for refcounting. This could
cause SEGV.
This patch introduce a third loop for wiping out all layers after
destroying all Evas_Object. So no more SEGV, and no performance
regression.
Note: Do not rely on evas_object_layer_get on smart object's child, it
could give you the wrong answer.
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@41046
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
obj = (Evas_Object *)lay->objects;
evas_object_free(obj, 0);
}
- free(lay);
+}
+
+void
+evas_layer_clean(Evas *e)
+{
+ Evas_Layer *tmp;
+
+ while (e->layers)
+ {
+ tmp = e->layers;
+ evas_layer_del(tmp);
+ free(tmp);
+ }
}
Evas_Layer *
/**
* Sets the layer of the evas that the given object will be part of.
+ *
+ * It is not possible to change the layer of a smart object's child.
+ *
* @param obj The given evas object.
* @param l The number of the layer to place the object on.
*/
/**
* Retrieves the layer of the evas that the given object is part of.
+ *
+ * Be carefull, it doesn't make sense to change the layer of smart object's
+ * child. So the returned value could be wrong in some case. Don't rely on
+ * it's accuracy.
+ *
* @param obj The given evas object.
* @return Number of the layer.
*/
}
}
}
- while (e->layers)
- {
- lay = e->layers;
- evas_layer_del(lay);
- evas_layer_free(lay);
- }
+ EINA_INLIST_FOREACH(e->layers, lay)
+ evas_layer_free(lay);
+ evas_layer_clean(e);
+
e->walking_list--;
evas_font_path_clear(e);
Evas_Layer *evas_layer_new(Evas *e);
void evas_layer_pre_free(Evas_Layer *lay);
void evas_layer_free(Evas_Layer *lay);
+void evas_layer_clean(Evas *e);
Evas_Layer *evas_layer_find(Evas *e, short layer_num);
void evas_layer_add(Evas_Layer *lay);
void evas_layer_del(Evas_Layer *lay);