Fixing bug 441923. Stop our SDK sample plugins from crashing on destruction. r+sr=jonas@sicking.cc

This commit is contained in:
Johnny Stenback 2008-06-25 17:00:59 -07:00
parent 3c3ddb020f
commit de3d3fb4db
5 changed files with 16 additions and 10 deletions

View File

@ -95,8 +95,10 @@ nsPluginInstance::~nsPluginInstance()
// 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);
if (mScriptablePeer) {
mScriptablePeer->SetInstance(NULL);
NS_RELEASE(mScriptablePeer);
}
}
NPBool nsPluginInstance::init(NPWindow* aWindow)

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -126,8 +126,10 @@ nsPluginInstance::~nsPluginInstance()
// 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);
if (mScriptablePeer) {
mScriptablePeer->SetInstance(NULL);
NS_RELEASE(mScriptablePeer);
}
}
static void

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -93,8 +93,10 @@ nsPluginInstance::~nsPluginInstance()
// 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);
if (mScriptablePeer) {
mScriptablePeer->SetInstance(NULL);
NS_RELEASE(mScriptablePeer);
}
}
static LRESULT CALLBACK PluginWinProc(HWND, UINT, WPARAM, LPARAM);

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*