summaryrefslogtreecommitdiff
path: root/legacy
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
parent9394f731041d10bbef9fd44a64230250e64cc708 (diff)
* 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')
-rw-r--r--legacy/evas/src/lib/canvas/evas_layer.c22
-rw-r--r--legacy/evas/src/lib/canvas/evas_main.c10
-rw-r--r--legacy/evas/src/lib/include/evas_private.h1
3 files changed, 26 insertions, 7 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_layer.c b/legacy/evas/src/lib/canvas/evas_layer.c
index da15d54..241de45 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)
71 obj = (Evas_Object *)lay->objects; 71 obj = (Evas_Object *)lay->objects;
72 evas_object_free(obj, 0); 72 evas_object_free(obj, 0);
73 } 73 }
74 free(lay); 74}
75
76void
77evas_layer_clean(Evas *e)
78{
79 Evas_Layer *tmp;
80
81 while (e->layers)
82 {
83 tmp = e->layers;
84 evas_layer_del(tmp);
85 free(tmp);
86 }
75} 87}
76 88
77Evas_Layer * 89Evas_Layer *
@@ -122,6 +134,9 @@ evas_layer_del(Evas_Layer *lay)
122 134
123/** 135/**
124 * Sets the layer of the evas that the given object will be part of. 136 * Sets the layer of the evas that the given object will be part of.
137 *
138 * It is not possible to change the layer of a smart object's child.
139 *
125 * @param obj The given evas object. 140 * @param obj The given evas object.
126 * @param l The number of the layer to place the object on. 141 * @param l The number of the layer to place the object on.
127 */ 142 */
@@ -170,6 +185,11 @@ evas_object_layer_set(Evas_Object *obj, short l)
170 185
171/** 186/**
172 * Retrieves the layer of the evas that the given object is part of. 187 * Retrieves the layer of the evas that the given object is part of.
188 *
189 * Be carefull, it doesn't make sense to change the layer of smart object's
190 * child. So the returned value could be wrong in some case. Don't rely on
191 * it's accuracy.
192 *
173 * @param obj The given evas object. 193 * @param obj The given evas object.
174 * @return Number of the layer. 194 * @return Number of the layer.
175 */ 195 */
diff --git a/legacy/evas/src/lib/canvas/evas_main.c b/legacy/evas/src/lib/canvas/evas_main.c
index 2d2065b..8e07c54 100644
--- a/legacy/evas/src/lib/canvas/evas_main.c
+++ b/legacy/evas/src/lib/canvas/evas_main.c
@@ -158,12 +158,10 @@ evas_free(Evas *e)
158 } 158 }
159 } 159 }
160 } 160 }
161 while (e->layers) 161 EINA_INLIST_FOREACH(e->layers, lay)
162 { 162 evas_layer_free(lay);
163 lay = e->layers; 163 evas_layer_clean(e);
164 evas_layer_del(lay); 164
165 evas_layer_free(lay);
166 }
167 e->walking_list--; 165 e->walking_list--;
168 166
169 evas_font_path_clear(e); 167 evas_font_path_clear(e);
diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h
index 7304966..87e9134 100644
--- a/legacy/evas/src/lib/include/evas_private.h
+++ b/legacy/evas/src/lib/include/evas_private.h
@@ -718,6 +718,7 @@ void evas_object_recalc_clippees(Evas_Object *obj);
718Evas_Layer *evas_layer_new(Evas *e); 718Evas_Layer *evas_layer_new(Evas *e);
719void evas_layer_pre_free(Evas_Layer *lay); 719void evas_layer_pre_free(Evas_Layer *lay);
720void evas_layer_free(Evas_Layer *lay); 720void evas_layer_free(Evas_Layer *lay);
721void evas_layer_clean(Evas *e);
721Evas_Layer *evas_layer_find(Evas *e, short layer_num); 722Evas_Layer *evas_layer_find(Evas *e, short layer_num);
722void evas_layer_add(Evas_Layer *lay); 723void evas_layer_add(Evas_Layer *lay);
723void evas_layer_del(Evas_Layer *lay); 724void evas_layer_del(Evas_Layer *lay);