Commit 614d104e authored by Damien Fouilleul's avatar Damien Fouilleul

- mozilla: refcounting is still important, don't mess it up during normal operation

parent f0996b77
...@@ -87,43 +87,33 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::getProperty(int index, NPVaria ...@@ -87,43 +87,33 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::getProperty(int index, NPVaria
{ {
case ID_root_audio: case ID_root_audio:
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( audioObj ) if( ! audioObj )
NPN_RetainObject(audioObj);
else
audioObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcAudioNPObject>::getClass()); audioObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcAudioNPObject>::getClass());
OBJECT_TO_NPVARIANT(audioObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
case ID_root_input: case ID_root_input:
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( inputObj ) if( ! inputObj )
NPN_RetainObject(inputObj);
else
inputObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcInputNPObject>::getClass()); inputObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcInputNPObject>::getClass());
OBJECT_TO_NPVARIANT(inputObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
case ID_root_log: case ID_root_log:
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( logObj ) if( ! logObj )
NPN_RetainObject(logObj);
else
logObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcLogNPObject>::getClass()); logObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcLogNPObject>::getClass());
OBJECT_TO_NPVARIANT(logObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(logObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
case ID_root_playlist: case ID_root_playlist:
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( playlistObj ) if( ! playlistObj )
NPN_RetainObject(playlistObj);
else
playlistObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistNPObject>::getClass()); playlistObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistNPObject>::getClass());
OBJECT_TO_NPVARIANT(playlistObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
case ID_root_video: case ID_root_video:
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( videoObj ) if( ! videoObj )
NPN_RetainObject(videoObj);
else
videoObj = NPN_CreateObject(_instance,RuntimeNPClass<LibvlcVideoNPObject>::getClass()); videoObj = NPN_CreateObject(_instance,RuntimeNPClass<LibvlcVideoNPObject>::getClass());
OBJECT_TO_NPVARIANT(videoObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
case ID_root_VersionInfo: case ID_root_VersionInfo:
{ {
...@@ -1089,11 +1079,9 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::getProperty(int index, NPVarian ...@@ -1089,11 +1079,9 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::getProperty(int index, NPVarian
case ID_log_messages: case ID_log_messages:
{ {
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( messagesObj ) if( ! messagesObj )
NPN_RetainObject(messagesObj);
else
messagesObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass()); messagesObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass());
OBJECT_TO_NPVARIANT(messagesObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(messagesObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
case ID_log_verbosity: case ID_log_verbosity:
...@@ -1369,11 +1357,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV ...@@ -1369,11 +1357,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
case ID_playlist_items: case ID_playlist_items:
{ {
// create child object in lazyman fashion to avoid ownership problem with firefox // create child object in lazyman fashion to avoid ownership problem with firefox
if( playlistItemsObj ) if( ! playlistItemsObj )
NPN_RetainObject(playlistItemsObj);
else
playlistItemsObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistItemsNPObject>::getClass()); playlistItemsObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistItemsNPObject>::getClass());
OBJECT_TO_NPVARIANT(playlistItemsObj, result); OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistItemsObj), result);
return INVOKERESULT_NO_ERROR; return INVOKERESULT_NO_ERROR;
} }
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment