summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-12-28 15:13:55 +0900
committerHermet Park <hermetpark@gmail.com>2018-12-28 15:13:55 +0900
commitfe05e5559b24c0df1616e2a7d1f7faefe5048bab (patch)
tree40f3732909dc712c8f2de770b289f1aad6bc21cf
parent5a46f2136a03af6d54dedf829bcf1ec398626a0e (diff)
evas vg: stablizing parenting logic.
Cleaned up the case when null parent is coming. and found out efl_data_scope_get() could return invalid data when invalid CLASS type is given. it's handled as well.
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_node.c39
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c1
2 files changed, 22 insertions, 18 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_vg_node.c b/src/lib/evas/canvas/efl_canvas_vg_node.c
index e5cc6c9776..a79de36962 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_node.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_node.c
@@ -25,11 +25,11 @@ _node_change(Efl_VG *obj, Efl_Canvas_Vg_Node_Data *nd)
25 Eo *p = obj; 25 Eo *p = obj;
26 while ((p = efl_parent_get(p))) 26 while ((p = efl_parent_get(p)))
27 { 27 {
28 if (!efl_isa(p, MY_CLASS)) break;
28 Efl_Canvas_Vg_Node_Data *pnd = efl_data_scope_get(p, MY_CLASS); 29 Efl_Canvas_Vg_Node_Data *pnd = efl_data_scope_get(p, MY_CLASS);
29 if (!pnd || (pnd->flags != EFL_GFX_CHANGE_FLAG_NONE)) break; 30 if (pnd->flags != EFL_GFX_CHANGE_FLAG_NONE) break;
30 pnd->flags = EFL_GFX_CHANGE_FLAG_ALL; 31 pnd->flags = EFL_GFX_CHANGE_FLAG_ALL;
31 } 32 }
32
33 efl_canvas_vg_object_change(nd->vd); 33 efl_canvas_vg_object_change(nd->vd);
34} 34}
35 35
@@ -327,23 +327,29 @@ _efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
327 Efl_Canvas_Vg_Container_Data *old_cd; 327 Efl_Canvas_Vg_Container_Data *old_cd;
328 Efl_VG *old_parent; 328 Efl_VG *old_parent;
329 329
330 if (efl_isa(parent, EFL_CANVAS_VG_CONTAINER_CLASS)) 330 if (parent)
331 cd = efl_data_scope_get(parent, EFL_CANVAS_VG_CONTAINER_CLASS);
332 else if (efl_isa(parent, EFL_CANVAS_VG_OBJECT_CLASS))
333 { 331 {
334 if (nd->vg_obj != parent) 332 if (efl_isa(parent, EFL_CANVAS_VG_CONTAINER_CLASS))
333 cd = efl_data_scope_get(parent, EFL_CANVAS_VG_CONTAINER_CLASS);
334 else if (efl_isa(parent, EFL_CANVAS_VG_OBJECT_CLASS))
335 { 335 {
336 nd->vg_obj = parent; 336 if (nd->vg_obj != parent)
337 nd->vd = efl_data_scope_get(parent, EFL_CANVAS_VG_OBJECT_CLASS); 337 {
338 efl_canvas_vg_container_vg_obj_update(obj, nd); 338 nd->vg_obj = parent;
339 nd->vd = efl_data_scope_get(parent, EFL_CANVAS_VG_OBJECT_CLASS);
340 }
341 }
342 else
343 {
344 ERR("parent(%p, class = %s) is not allowed by vg node(%p).",
345 parent, efl_class_name_get(efl_class_get(parent)), obj);
346 return;
339 } 347 }
340
341 } 348 }
342 else if (parent) 349 else
343 { 350 {
344 ERR("parent(%p, class = %s) is not allowed by vg node(%p).", 351 nd->vg_obj = NULL;
345 parent, efl_class_name_get(efl_class_get(parent)), obj); 352 nd->vd = NULL;
346 return;
347 } 353 }
348 354
349 if (!_efl_canvas_vg_node_parent_checked_get(obj, &old_parent, &old_cd)) 355 if (!_efl_canvas_vg_node_parent_checked_get(obj, &old_parent, &old_cd))
@@ -365,17 +371,14 @@ _efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
365 _efl_canvas_vg_node_name_insert(obj, cd); 371 _efl_canvas_vg_node_name_insert(obj, cd);
366 372
367 Efl_Canvas_Vg_Node_Data *parent_nd = efl_data_scope_get(parent, MY_CLASS); 373 Efl_Canvas_Vg_Node_Data *parent_nd = efl_data_scope_get(parent, MY_CLASS);
368 _node_change(parent, parent_nd);
369
370 if (nd->vg_obj != parent_nd->vg_obj) 374 if (nd->vg_obj != parent_nd->vg_obj)
371 { 375 {
372 nd->vg_obj = parent_nd->vg_obj; 376 nd->vg_obj = parent_nd->vg_obj;
373 nd->vd = parent_nd->vd; 377 nd->vd = parent_nd->vd;
374 efl_canvas_vg_container_vg_obj_update(obj, nd);
375 } 378 }
376 } 379 }
377 380
378 _node_change(obj, nd); 381 if (parent) _node_change(obj, nd);
379} 382}
380 383
381static void 384static void
diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c
index ffbc3016b9..6b64b7a7fe 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -347,6 +347,7 @@ static Efl_Object *
347_efl_canvas_vg_object_efl_object_finalize(Eo *obj, Efl_Canvas_Vg_Object_Data *pd) 347_efl_canvas_vg_object_efl_object_finalize(Eo *obj, Efl_Canvas_Vg_Object_Data *pd)
348{ 348{
349 Evas *e = evas_object_evas_get(obj); 349 Evas *e = evas_object_evas_get(obj);
350 efl_parent_set(pd->root, obj);
350 351
351 // TODO: If we start to have to many Evas_Object_VG per canvas, it may be nice 352 // TODO: If we start to have to many Evas_Object_VG per canvas, it may be nice
352 // to actually have one event per canvas and one array per canvas to. 353 // to actually have one event per canvas and one array per canvas to.