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:
av%netscape.com
2002-08-07 02:46:43 +00:00
parent c94631fb82
commit 7e4a776640
14 changed files with 53 additions and 20 deletions

View File

@@ -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)