hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=181ec112f6cc577c4efc7f7a5550a186bf97c9d3

commit 181ec112f6cc577c4efc7f7a5550a186bf97c9d3
Author: Hermet Park <hermetp...@gmail.com>
Date:   Fri Dec 13 11:52:15 2019 +0900

    evas vg: fix memory corruption for user entry.
    
    Container must have a set parent after construction.
    efl_add_ref() with a parent won't work this case
    because container needs some jobs in overriding parent_set() after proper 
intialization.
---
 src/lib/evas/canvas/efl_canvas_vg_object.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c 
b/src/lib/evas/canvas/efl_canvas_vg_object.c
index 4b6d5221a7..740cfacc6c 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_object.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
@@ -369,7 +369,7 @@ _efl_canvas_vg_object_efl_object_constructor(Eo *eo_obj, 
Efl_Canvas_Vg_Object_Da
 
    /* default root node */
    pd->obj = obj;
-   pd->root = efl_add_ref(EFL_CANVAS_VG_CONTAINER_CLASS, eo_obj);
+   pd->root = efl_add_ref(EFL_CANVAS_VG_CONTAINER_CLASS, NULL);
 
    eina_array_step_set(&pd->cleanup, sizeof(pd->cleanup), 8);
 
@@ -381,6 +381,12 @@ _efl_canvas_vg_object_efl_object_finalize(Eo *obj, 
Efl_Canvas_Vg_Object_Data *pd
 {
    Evas *e = evas_object_evas_get(obj);
 
+   /* Container must have a set parent after construction.
+      efl_add_ref() with a parent won't work this case 
+      because container needs some jobs in overriding parent_set()
+      after proper intialization. */
+   efl_parent_set(pd->root, obj);
+
    // TODO: If we start to have to many Evas_Object_VG per canvas, it may be 
nice
    // to actually have one event per canvas and one array per canvas to.
    efl_event_callback_add(e, EFL_CANVAS_SCENE_EVENT_RENDER_POST, 
_cleanup_reference, pd);

-- 


Reply via email to