Fix for Speech plugin crashing. Also adding try{} to make sure the code doesn't... 03/9903/1 submit/tizen/20130911.153137
authorbrianjjones <brian.j.jones@intel.com>
Wed, 11 Sep 2013 02:26:03 +0000 (19:26 -0700)
committerbrianjjones <brian.j.jones@intel.com>
Wed, 11 Sep 2013 02:31:43 +0000 (19:31 -0700)
Change-Id: I5b358996aaa34bee99b548b4f331d23569bd1fc5
Signed-off-by: brianjjones <brian.j.jones@intel.com>
src/Speech/JSSpeech.cpp

index 6ee9c25..9bdec51 100644 (file)
@@ -122,25 +122,23 @@ JSValueRef JSSpeech::setCBListener(JSContextRef context,
 
        SpeechPrivObject* privateObject = static_cast<SpeechPrivObject*>(JSObjectGetPrivate(thisObject));
 
-       LoggerD("setCBListener break 1");
-
        if (NULL == privateObject)
        {
                LoggerE("private object is null");
        }
 
-       LoggerD("setCBListener break 2");
-
-       SpeechPtr speechPtr(privateObject->getObject());                        //get the private object
-
-       LoggerD("setCBListener break 3");
-
-       JSContextRef gContext = privateObject->getContext();                    // get the private context
-
-       ArgumentValidator validator(context, argumentCount, arguments);         //set up argument validator
-       JSObjectRef callbackObj = validator.toCallbackObject(0,false,"onaudiostart","onsoundstart","onspeechstart", "onspeechend", "onsoundend", "onresult", "onnomatch", "onerror", "onstart", "onend", "NULL");
-       JSValueProtect(context, callbackObj);
-       speechPtr->setCBListener(callbackObj, gContext);
+       try{
+               SpeechPtr speechPtr(privateObject->getObject());                        //get the private object
+               JSContextRef gContext = privateObject->getContext();                    // get the private context
+               ArgumentValidator validator(context, argumentCount, arguments);         //set up argument validator
+               JSObjectRef callbackObj = validator.toCallbackObject(0,false,"onaudiostart","onsoundstart","onspeechstart", "onspeechend", "onsoundend", "onresult", "onnomatch", "onerror", "onstart", "onend", NULL);
+               JSValueProtect(context, callbackObj);
+               speechPtr->setCBListener(callbackObj, gContext);
+       }
+       catch(...)
+       {
+               LoggerE("WRT Speech plugin failed on setCBListener");
+       }
 
        return JSValueMakeUndefined(context);
 }