Bug 521377 - 'NPRuntime: Segfault when NPP_GetValue_NPPVpluginScriptableNPObject returns a null actor'. r=bsmedberg+valgrind.

This commit is contained in:
Ben Turner
2010-01-15 12:35:57 -08:00
parent 58f2affa6d
commit 04b4054acf
19 changed files with 1544 additions and 957 deletions

View File

@@ -160,7 +160,7 @@ PluginModuleParent::SetPluginFuncs(NPPluginFuncs* aFuncs)
NPError
PluginModuleParent::NPP_Destroy(NPP instance,
NPSavedData** save)
NPSavedData** /*saved*/)
{
// FIXME/cjones:
// (1) send a "destroy" message to the child
@@ -175,15 +175,14 @@ PluginModuleParent::NPP_Destroy(NPP instance,
if (!parentInstance)
return NPERR_NO_ERROR;
parentInstance->Destroy();
NPError prv;
if (!PPluginInstanceParent::Call__delete__(parentInstance, &prv)) {
prv = NPERR_GENERIC_ERROR;
}
NPError retval = parentInstance->Destroy();
instance->pdata = nsnull;
return prv;
if (!PluginInstanceParent::Call__delete__(parentInstance)) {
NS_ERROR("Failed to delete instance!");
}
return retval;
}
bool
@@ -641,6 +640,11 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
PluginInstanceParent* parentInstance =
new PluginInstanceParent(this, instance, mNPNIface);
if (!parentInstance->Init()) {
delete parentInstance;
return NS_ERROR_FAILURE;
}
instance->pdata = parentInstance;
if (!CallPPluginInstanceConstructor(parentInstance,
@@ -657,9 +661,8 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
}
if (*error != NPERR_NO_ERROR) {
PPluginInstanceParent::Call__delete__(parentInstance, error);
instance->pdata = nsnull;
return NS_ERROR_FAILURE;
NPP_Destroy(instance, 0);
return *error;
}
return NS_OK;