fix private objects management 29/8529/1
authorLuc Yriarte <luc.yriarte@intel.com>
Wed, 21 Aug 2013 14:36:10 +0000 (16:36 +0200)
committerLuc Yriarte <luc.yriarte@intel.com>
Wed, 21 Aug 2013 14:36:10 +0000 (16:36 +0200)
src/MediaServer/JSMediaServer.cpp
src/MediaServer/JSMediaServerManager.cpp

index 1afcc48..768e772 100644 (file)
@@ -166,7 +166,7 @@ JSValueRef JSMediaServer::browse(JSContextRef context,
 {
        LoggerD("Entered JSMediaServer::browse");
        // TODO try/catch block
-               MediaServerPrivObject* privateObject = static_cast<MediaServerPrivObject*>(JSObjectGetPrivate(object));
+               MediaServerPrivObject* privateObject = static_cast<MediaServerPrivObject*>(JSObjectGetPrivate(thisObject));
                if (NULL == privateObject)
                {
                        LoggerE("private object is null");
@@ -211,7 +211,7 @@ JSValueRef JSMediaServer::find(JSContextRef context,
 {
        LoggerD("Entered JSMediaServer::find");
        // TODO try/catch block
-               MediaServerPrivObject* privateObject = static_cast<MediaServerPrivObject*>(JSObjectGetPrivate(object));
+               MediaServerPrivObject* privateObject = static_cast<MediaServerPrivObject*>(JSObjectGetPrivate(thisObject));
                if (NULL == privateObject)
                {
                        LoggerE("private object is null");
index 80f7818..b34d8fd 100644 (file)
@@ -107,13 +107,11 @@ JSValueRef JSMediaServerManager::scanNetwork(JSContextRef context,
        LoggerD("Entered JSMediaServerManager::scanNetwork");
 
        // TODO try/catch block
-               MediaServerManagerPrivObject* privateObject = static_cast<MediaServerManagerPrivObject*>(JSObjectGetPrivate(object));
+               MediaServerManagerPrivObject* privateObject = static_cast<MediaServerManagerPrivObject*>(JSObjectGetPrivate(thisObject));
                if (NULL == privateObject)
                {
                        LoggerE("private object is null");
-                       // FIXME re-doing intialization ? several instances ?
-                       MediaServerManagerPtr mediaservermanager(new MediaServerManager());
-                       privateObject = new MediaServerManagerPrivObject( context, mediaservermanager);
+                       // TODO post exception
                }
 
        // TODO use event handlers instead of callbacks