(MeshActor) Add a reference to AnimatableMesh 74/24074/1
authorXiangyin Ma <x1.ma@samsung.com>
Wed, 11 Jun 2014 10:24:25 +0000 (11:24 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 13:14:59 +0000 (14:14 +0100)
[problem]      AnimatableMesh get deleted before MeshActor
[solution]     Keep a reference to the AnimatableMesh so it would not be destroyed before the MeshActor object

Change-Id: Ib56bd23ddd630e4fb25f65310bd639f76a656fa3
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
dali/internal/event/actors/mesh-actor-impl.cpp
dali/internal/event/actors/mesh-actor-impl.h

index f91bd07..74bef56 100644 (file)
@@ -131,6 +131,7 @@ void MeshActor::SetMesh(Dali::Mesh mesh)
 
 void MeshActor::SetMesh(Dali::AnimatableMesh mesh)
 {
+  mAnimatableMeshHandle = mesh;
   SetMesh( GetImplementation(mesh).GetMesh() );
 
   SetInitialVolume(Vector3(1.0f, 1.0f, 1.0f));
index d3b1020..75e9e39 100644 (file)
@@ -22,7 +22,7 @@
 #include <cstddef>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/object/handle.h>
 #include <dali/public-api/actors/mesh-actor.h>
 #include <dali/public-api/geometry/mesh.h>
 #include <dali/public-api/modeling/entity.h>
@@ -157,6 +157,8 @@ protected:
 
 private:
   Internal::MeshAttachmentPtr mMeshAttachment;
+  // To keep a reference to the AnimatableMesh so it would not be destroyed before the MeshActor object
+  Dali::Handle                mAnimatableMeshHandle;
 };
 
 } // namespace Internal