On Fri, Jun 15, 2018 at 4:05 AM, Hermet Park <hermetp...@gmail.com> wrote:
> Eo* obj = evas_object_vg_add(canvas);
> Efl_VG* root = evas_vg_container_add(obj);
> evas_object_vg_root_node_set(obj, root);
> efl_parent_set(root, NULL);
>
> **crash**

maybe a unit test should be added ?

Vincent

>
>
> On Fri, Jun 15, 2018 at 1:17 AM, Mike Blumenkrantz <
> michael.blumenkra...@gmail.com> wrote:
>
>> Are there tests for any of these things that are being fixed?
>>
>> On Thu, Jun 14, 2018 at 12:11 PM Hermet Park <hermetp...@gmail.com> wrote:
>>
>> > hermet pushed a commit to branch master.
>> >
>> >
>> > http://git.enlightenment.org/core/efl.git/commit/?id=
>> c8c0dbb32bd7f38b0faf524b1a55585f99d1cb17
>> >
>> > commit c8c0dbb32bd7f38b0faf524b1a55585f99d1cb17
>> > Author: Hermet Park <hermetp...@gmail.com>
>> > Date:   Fri Jun 15 01:00:53 2018 +0900
>> >
>> >     evas vg: prevent a corner-case crash.
>> >
>> >     tbh, current vg interfaces a little bit bad... here is one scenario
>> to
>> > this
>> >     stupid case.
>> >
>> >     efl_parent_set() and evas_object_vg_root_node_set() both do re-parent
>> >      job. They could be conflicted if user calls both apis in either way.
>> >
>> >     efl_parent_set(root_node, NULL); but Vg Object still keeps the root
>> > node
>> >     which is just a dangling pointer that occurs a crash while rendering.
>> > ---
>> >  src/lib/evas/canvas/efl_canvas_vg_object.c |  2 ++
>> >  src/lib/evas/canvas/evas_vg_node.c         | 23 +++++++++++++++++++++++
>> >  src/lib/evas/canvas/evas_vg_private.h      |  5 +++++
>> >  3 files changed, 30 insertions(+)
>> >
>> > diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c
>> > b/src/lib/evas/canvas/efl_canvas_vg_object.c
>> > index c39fc5b980..cfd1898326 100644
>> > --- a/src/lib/evas/canvas/efl_canvas_vg_object.c
>> > +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
>> > @@ -172,6 +172,8 @@ _efl_canvas_vg_object_root_node_set(Eo *obj,
>> > Efl_Canvas_Vg_Object_Data *pd, Efl_
>> >
>> >          // set the parent so that vg canvas can render it.
>> >          efl_parent_set(pd->user_entry->root, pd->root);
>> > +
>> > +        efl_canvas_vg_node_root_set(root_node, obj);
>> >       }
>> >     else if (pd->user_entry)
>> >       {
>> > diff --git a/src/lib/evas/canvas/evas_vg_node.c
>> > b/src/lib/evas/canvas/evas_vg_node.c
>> > index ac054d4c07..1427beb693 100644
>> > --- a/src/lib/evas/canvas/evas_vg_node.c
>> > +++ b/src/lib/evas/canvas/evas_vg_node.c
>> > @@ -322,9 +322,24 @@ _efl_canvas_vg_node_efl_object_parent_set(Eo *obj,
>> >  {
>> >     Efl_Canvas_Vg_Container_Data *cd = NULL;
>> >     Efl_Canvas_Vg_Container_Data *old_cd;
>> > +   Efl_Canvas_Vg_Node_Data *nd;
>> >     Efl_VG *old_parent;
>> >     Eina_Bool parent_container = EINA_TRUE;
>> >
>> > +   nd = efl_data_scope_get(obj, MY_CLASS);
>> > +
>> > +   //No, prevent infinite calls parent_set() -> root_node_set() ->
>> > parent_set() -> ...
>> > +   if (nd->parenting) return;
>> > +
>> > +   //Cut off root node from vg object if it does....
>> > +   if (nd->vg_obj)
>> > +     {
>> > +        nd->parenting = EINA_TRUE;
>> > +        evas_object_vg_root_node_set(nd->vg_obj, NULL);
>> > +        nd->parenting = EINA_FALSE;
>> > +        nd->vg_obj = NULL;
>> > +     }
>> > +
>> >     if (efl_isa(parent, EFL_CANVAS_VG_CONTAINER_CLASS))
>> >       cd = efl_data_scope_get(parent, EFL_CANVAS_VG_CONTAINER_CLASS);
>> >     else if (efl_isa(parent, EFL_CANVAS_VG_OBJECT_CLASS))
>> > @@ -707,6 +722,14 @@ _efl_canvas_vg_node_efl_gfx_path_interpolate(Eo
>> *obj,
>> > Efl_Canvas_Vg_Node_Data *p
>> >     return EINA_TRUE;
>> >  }
>> >
>> > +void
>> > +efl_canvas_vg_node_root_set(Efl_VG *node, Efl_VG *vg_obj)
>> > +{
>> > +   Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(node, MY_CLASS);
>> > +   nd->vg_obj = vg_obj;
>> > +}
>> > +
>> > +
>> >  EOLIAN static Efl_VG *
>> >  _efl_canvas_vg_node_efl_duplicate_duplicate(const Eo *obj,
>> > Efl_Canvas_Vg_Node_Data *pd)
>> >  {
>> > diff --git a/src/lib/evas/canvas/evas_vg_private.h
>> > b/src/lib/evas/canvas/evas_vg_private.h
>> > index 4ff8b2bb45..cc43fb03ab 100644
>> > --- a/src/lib/evas/canvas/evas_vg_private.h
>> > +++ b/src/lib/evas/canvas/evas_vg_private.h
>> > @@ -62,6 +62,8 @@ struct _Efl_Canvas_Vg_Node_Data
>> >     Efl_Canvas_Vg_Node *mask;
>> >     Ector_Renderer *renderer;
>> >
>> > +   Efl_VG *vg_obj;
>> > +
>> >     void (*render_pre)(Eo *obj, Eina_Matrix3 *parent, Ector_Surface *s,
>> > void *data, Efl_Canvas_Vg_Node_Data *nd);
>> >     void *data;
>> >
>> > @@ -71,6 +73,7 @@ struct _Efl_Canvas_Vg_Node_Data
>> >
>> >     Eina_Bool visibility : 1;
>> >     Eina_Bool changed : 1;
>> > +   Eina_Bool parenting : 1;
>> >  };
>> >
>> >  struct _Efl_Canvas_Vg_Container_Data
>> > @@ -108,6 +111,8 @@ Vg_File_Data *
>> > evas_cache_vg_file_info(const char *file, const char
>> >
>> >  Eina_Bool                   evas_vg_save_to_file(Vg_File_Data
>> *evg_data,
>> > const char *file, const char *key, const char *flags);
>> >
>> > +void                        efl_canvas_vg_node_root_set(Efl_VG *node,
>> > Efl_VG *vg_obj);
>> > +
>> >  static inline Efl_Canvas_Vg_Node_Data *
>> >  _evas_vg_render_pre(Efl_VG *child, Ector_Surface *s, Eina_Matrix3 *m)
>> >  {
>> >
>> > --
>> >
>> >
>> >
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> enlightenment-devel mailing list
>> enlightenment-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>
>
>
> --
> Regards, Hermet
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to