From 74cee52900fa31d01fc68b4735ccd3185cd89859 Mon Sep 17 00:00:00 2001 From: Subhransu Mohanty Date: Thu, 19 May 2016 01:36:33 -0700 Subject: [PATCH] evas: fix the ref issue of newly created object in shape_dup() function Summary: There are couple of issue. By adding the gradient to both parent container as well as to the shape. when we dupe the container it copies twice. Usually we create one gradient and set it to multiple shape , in that case when we call dupe() function it is going to make a separate copy for each of the shape. The patch fixes 1st issue. for 2nd one we need to maybe change the way we implemented dupe function Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3961 Signed-off-by: Cedric Bail --- src/lib/evas/canvas/evas_vg_shape.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c index 80e4e03..b356b07 100644 --- a/src/lib/evas/canvas/evas_vg_shape.c +++ b/src/lib/evas/canvas/evas_vg_shape.c @@ -232,22 +232,25 @@ _efl_vg_shape_efl_vg_dup(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED, const Efl_V if (fromd->fill) { - fill = eo_add(eo_class_get(fromd->fill), parent, efl_vg_dup(eo_self, fromd->fill)); + fill = eo_add(eo_class_get(fromd->fill), NULL, efl_vg_dup(eo_self, fromd->fill)); + efl_vg_shape_fill_set(obj, fill); + eo_unref(fill); } if (fromd->stroke.fill) { - stroke_fill = eo_add(eo_class_get(fromd->stroke.fill), parent, efl_vg_dup(eo_self, fromd->stroke.fill)); + stroke_fill = eo_add(eo_class_get(fromd->stroke.fill), NULL, efl_vg_dup(eo_self, fromd->stroke.fill)); + efl_vg_shape_stroke_fill_set(obj, stroke_fill); + eo_unref(stroke_fill); } if (fromd->stroke.marker) { - stroke_marker = eo_add(eo_class_get(fromd->stroke.marker), parent, efl_vg_dup(eo_self, fromd->stroke.marker)); + stroke_marker = eo_add(eo_class_get(fromd->stroke.marker), NULL, efl_vg_dup(eo_self, fromd->stroke.marker)); + efl_vg_shape_stroke_marker_set(obj, stroke_marker); + eo_unref(stroke_marker); } - efl_vg_shape_fill_set(obj, fill); - efl_vg_shape_stroke_fill_set(obj, stroke_fill); - efl_vg_shape_stroke_marker_set(obj, stroke_marker); efl_gfx_shape_dup(obj, from); } -- 2.7.4