summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_vg_container.c
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-06-12 18:59:37 +0900
committerHermet Park <hermetpark@gmail.com>2018-06-12 19:08:35 +0900
commitf4851d311fdc9f5f1cffcc29b0a4916e3a7189b3 (patch)
treebbfefcdf206289d5d279e7a37c48a15f522106b7 /src/lib/evas/canvas/evas_vg_container.c
parent054eab8ad81e7fff1826eb3a3d90c897e976150a (diff)
evas vg: clean up all the duplicated children by container properly.
So, here is the first-aid, but the last patch for recovering basic vector rendering. All vg nodes duplicated by container would be constructed without a parent, they need to get unref() by container when container is freed. Here code takes deal with it on the invalidation time.
Diffstat (limited to 'src/lib/evas/canvas/evas_vg_container.c')
-rw-r--r--src/lib/evas/canvas/evas_vg_container.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c
index a1c3261..95b468a 100644
--- a/src/lib/evas/canvas/evas_vg_container.c
+++ b/src/lib/evas/canvas/evas_vg_container.c
@@ -6,6 +6,23 @@
6#define MY_CLASS EFL_CANVAS_VG_CONTAINER_CLASS 6#define MY_CLASS EFL_CANVAS_VG_CONTAINER_CLASS
7 7
8static void 8static void
9_invalidate_cb(void *data EINA_UNUSED, const Efl_Event *event)
10{
11 Efl_Canvas_Vg_Container_Data *pd;
12 Eina_List *l;
13 Efl_VG* child;
14
15 pd = efl_data_scope_get(event->object, MY_CLASS);
16
17 /* Clean up all the references by copying.
18 If the container is copied, it copies its children as well.
19 Since evas_vg_node is duplicated using efl_add_ref(),
20 we definitely call efl_unref() after that. */
21 EINA_LIST_FOREACH(pd->children, l, child)
22 efl_unref(child);
23}
24
25static void
9_efl_canvas_vg_container_render_pre(Eo *obj EINA_UNUSED, 26_efl_canvas_vg_container_render_pre(Eo *obj EINA_UNUSED,
10 Eina_Matrix3 *parent, 27 Eina_Matrix3 *parent,
11 Ector_Surface *s, 28 Ector_Surface *s,
@@ -59,9 +76,7 @@ _efl_canvas_vg_container_efl_object_destructor(Eo *obj,
59 Efl_Canvas_Vg_Container_Data *pd EINA_UNUSED) 76 Efl_Canvas_Vg_Container_Data *pd EINA_UNUSED)
60{ 77{
61 efl_destructor(efl_super(obj, MY_CLASS)); 78 efl_destructor(efl_super(obj, MY_CLASS));
62
63 eina_hash_free(pd->names); 79 eina_hash_free(pd->names);
64 pd->names = NULL;
65} 80}
66 81
67static void 82static void
@@ -160,6 +175,7 @@ _efl_canvas_vg_container_efl_duplicate_duplicate(const Eo *obj,
160 Efl_VG *container; 175 Efl_VG *container;
161 176
162 container = efl_duplicate(efl_super(obj, MY_CLASS)); 177 container = efl_duplicate(efl_super(obj, MY_CLASS));
178 efl_event_callback_add(container, EFL_EVENT_INVALIDATE, _invalidate_cb, NULL);
163 efl_parent_set(container, efl_parent_get(obj)); 179 efl_parent_set(container, efl_parent_get(obj));
164 180
165 //Copy Children 181 //Copy Children