Bug 159646 -- taking care of stale pointer in the plugin sample code, not part of the build
git-svn-id: svn://10.0.0.236/trunk@126581 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -99,6 +99,11 @@ nsPluginInstance::nsPluginInstance(NPP aInstance) : nsPluginInstanceBase(),
|
||||
|
||||
nsPluginInstance::~nsPluginInstance()
|
||||
{
|
||||
// mScriptablePeer may be also held by the browser
|
||||
// so releasing it here does not guarantee that it is over
|
||||
// we should take precaution in case it will be called later
|
||||
// and zero its mPlugin member
|
||||
mScriptablePeer->SetInstance(NULL);
|
||||
NS_IF_RELEASE(mScriptablePeer);
|
||||
}
|
||||
|
||||
@@ -246,7 +251,7 @@ NPError nsPluginInstance::GetValue(NPPVariable aVariable, void *aValue)
|
||||
// ==============================
|
||||
//
|
||||
// this method will return the scriptable object (and create it if necessary)
|
||||
nsIScriptablePlugin* nsPluginInstance::getScriptablePeer()
|
||||
nsScriptablePeer* nsPluginInstance::getScriptablePeer()
|
||||
{
|
||||
if (!mScriptablePeer) {
|
||||
mScriptablePeer = new nsScriptablePeer(this);
|
||||
@@ -259,6 +264,4 @@ nsIScriptablePlugin* nsPluginInstance::getScriptablePeer()
|
||||
// add reference for the caller requesting the object
|
||||
NS_ADDREF(mScriptablePeer);
|
||||
return mScriptablePeer;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user