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:
@@ -88,6 +88,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);
|
||||
}
|
||||
|
||||
@@ -184,7 +189,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);
|
||||
@@ -197,8 +202,6 @@ nsIScriptablePlugin* nsPluginInstance::getScriptablePeer()
|
||||
// add reference for the caller requesting the object
|
||||
NS_ADDREF(mScriptablePeer);
|
||||
return mScriptablePeer;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
Reference in New Issue
Block a user