aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/evas/src/lib/canvas/evas_layer.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2009-06-15 14:25:21 +0000
committerCedric BAIL <cedric.bail@free.fr>2009-06-15 14:25:21 +0000
commit14693fd07011f7e0a7cf8e1f9696871f998452b0 (patch)
treed74242ef0b2c54f85afb1b7a6d78fd466b8d629e /legacy/evas/src/lib/canvas/evas_layer.c
parentback to svn soname (diff)
downloadefl-14693fd07011f7e0a7cf8e1f9696871f998452b0.tar.gz
* evas: Fix SEGV when smart object's child come from another layer than
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. SVN revision: 41046
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_layer.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_layer.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_layer.c b/legacy/evas/src/lib/canvas/evas_layer.c
index da15d5458b..241de4536a 100644
--- a/legacy/evas/src/lib/canvas/evas_layer.c
+++ b/legacy/evas/src/lib/canvas/evas_layer.c
@@ -71,7 +71,19 @@ evas_layer_free(Evas_Layer *lay)
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 *
@@ -122,6 +134,9 @@ evas_layer_del(Evas_Layer *lay)
/**
* 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.
*/
@@ -170,6 +185,11 @@ evas_object_layer_set(Evas_Object *obj, short l)
/**
* 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.
*/