Fixed crash while wrapping a Control as an actor in JavaScript plugin 89/43489/2
authorRichard Huang <r.huang@samsung.com>
Thu, 9 Jul 2015 13:38:13 +0000 (14:38 +0100)
committerRichard Huang <r.huang@samsung.com>
Thu, 9 Jul 2015 13:45:59 +0000 (14:45 +0100)
Change-Id: I4c01b5a77836ffd9b22bf3c1b2aa2f809871f1c5

plugins/dali-script-v8/src/actors/actor-wrapper.cpp
plugins/dali-script-v8/src/dali-wrapper.cpp

index 7b9b1588f7a7f3b9472346921543c5a83443379b..149edb91451c372dd4ac997dcded78764162e089 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
+#include <dali-toolkit/public-api/controls/control.h>
 
 // INTERNAL INCLUDES
 #include <actors/layer-api.h>
@@ -318,7 +319,10 @@ ActorWrapper::ActorWrapper( Actor actor,
 v8::Handle<v8::Object> ActorWrapper::WrapActor(v8::Isolate* isolate, Actor actor )
 {
   v8::EscapableHandleScope handleScope( isolate );
-  v8::Local<v8::Object> object = WrapActor( isolate, actor, GetActorType( actor.GetTypeName() ) );
+
+  // Check whether the actor is a Control
+  ActorWrapper::ActorType type = Toolkit::Control::DownCast(actor) ? ACTOR : GetActorType( actor.GetTypeName() );
+  v8::Local<v8::Object> object = WrapActor( isolate, actor, type );
 
   return handleScope.Escape( object );
 }
index c716f750ccf8f52310b1988395ee10cb43e6cacf..257b5d482890a670f388c0869f604d889ab79316 100644 (file)
@@ -63,9 +63,7 @@ const ApiFunction ConstructorFunctionTable[]=
     { "PathConstrainer",    PathConstrainerWrapper::NewPathConstrainer},
     { "LinearConstrainer",  LinearConstrainerWrapper::NewLinearConstrainer},
     { "Actor",              ActorWrapper::NewActor },
-    { "TextActor",          ActorWrapper::NewActor },
     { "ImageActor",         ActorWrapper::NewActor },
-    { "MeshActor",          ActorWrapper::NewActor },
     { "CameraActor",        ActorWrapper::NewActor },
     { "Layer",              ActorWrapper::NewActor },
     { "Control",            ActorWrapper::NewControl },