evas: fix bug in the destructor of node in Evas_3D.
authorse.osadchy <se.osadchy@samsung.com>
Fri, 6 Mar 2015 18:12:57 +0000 (19:12 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 6 Mar 2015 19:19:22 +0000 (20:19 +0100)
Summary: Bug relative with segmentation fault if node isn't mesh_node type.

@fix

Reviewers: cedric, raster, Hermet

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2101

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/evas/canvas/evas_3d_node.c

index 09bffc8..1f69cdc 100644 (file)
@@ -621,7 +621,12 @@ _node_free(Evas_3D_Object *obj)
         eina_list_free(pd->members);
      }
 
-   if (pd->data.mesh.meshes)
+   if (pd->parent)
+     {
+        eo_do(pd->parent, evas_3d_node_member_del(obj));
+     }
+
+   if (pd->type == EVAS_3D_NODE_TYPE_MESH && pd->data.mesh.meshes)
      {
         Eina_List *l;
         Evas_3D_Mesh *m;
@@ -632,10 +637,10 @@ _node_free(Evas_3D_Object *obj)
           }
 
         eina_list_free(pd->data.mesh.meshes);
-     }
 
-   if (pd->data.mesh.node_meshes)
-     eina_hash_free(pd->data.mesh.node_meshes);
+        if (pd->data.mesh.node_meshes)
+          eina_hash_free(pd->data.mesh.node_meshes);
+     }
 
    if (pd->scenes_root)
      eina_hash_free(pd->scenes_root);