evas: fix the ref issue of newly created object in shape_dup() function
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Thu, 19 May 2016 08:36:33 +0000 (01:36 -0700)
committerCedric Bail <cedric@osg.samsung.com>
Thu, 19 May 2016 09:23:56 +0000 (02:23 -0700)
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 <cedric@osg.samsung.com>
src/lib/evas/canvas/evas_vg_shape.c

index 80e4e03..b356b07 100644 (file)
@@ -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);
 }