Bug 300853 Caps crash on cleanup [@ DomainPolicy::Drop]

patch by g.maone@informaction.com r=caillon sr=dveditz a=bsmedberg
This commit is contained in:
timeless%mozdev.org 2005-07-19 21:55:36 +00:00
Родитель 5c3c5c02bf
Коммит 741e9f0d95
4 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -21,6 +21,7 @@
* *
* Contributor(s): * Contributor(s):
* Christopher A. Aillon <christopher@aillon.com> * Christopher A. Aillon <christopher@aillon.com>
* Giorgio Maone <g.maone@informaction.com>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or * either the GNU General Public License Version 2 or later (the "GPL"), or

Просмотреть файл

@ -23,6 +23,7 @@
* Norris Boyd <nboyd@atg.com> * Norris Boyd <nboyd@atg.com>
* Mitch Stoltz <mstoltz@netscape.com> * Mitch Stoltz <mstoltz@netscape.com>
* Christopher A. Aillon <christopher@aillon.com> * Christopher A. Aillon <christopher@aillon.com>
* Giorgio Maone <g.maone@informaction.com>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"), * either of the GNU General Public License Version 2 or later (the "GPL"),
@ -79,6 +80,7 @@ struct ClassPolicy;
#define DEBUG_CAPS_CanCreateWrapper #define DEBUG_CAPS_CanCreateWrapper
#define DEBUG_CAPS_CanCreateInstance #define DEBUG_CAPS_CanCreateInstance
#define DEBUG_CAPS_CanGetService #define DEBUG_CAPS_CanGetService
#define DEBUG_CAPS_DomainPolicyLifeCycle
#endif #endif
///////////////////// /////////////////////
@ -290,8 +292,9 @@ public:
~DomainPolicy() ~DomainPolicy()
{ {
PL_DHashTableFinish(this); PL_DHashTableFinish(this);
NS_ASSERTION(mRefCount == 0, "Wrong refcount in DomainPolicy dtor");
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle #ifdef DEBUG_CAPS_DomainPolicyLifeCycle
printf("DomainPolicy deleted with mRefCount = %d\n", mRefCount);
--sObjects; --sObjects;
_printPopulationInfo(); _printPopulationInfo();
#endif #endif

Просмотреть файл

@ -21,6 +21,7 @@
* *
* Contributor(s): * Contributor(s):
* Christopher A. Aillon <christopher@aillon.com> * Christopher A. Aillon <christopher@aillon.com>
* Giorgio Maone <g.maone@informaction.com>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or * either the GNU General Public License Version 2 or later (the "GPL"), or

Просмотреть файл

@ -24,6 +24,7 @@
* Mitch Stoltz * Mitch Stoltz
* Steve Morse * Steve Morse
* Christopher A. Aillon * Christopher A. Aillon
* Giorgio Maone
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"), * either of the GNU General Public License Version 2 or later (the "GPL"),
@ -2891,7 +2892,8 @@ jsval nsScriptSecurityManager::sEnabledID = JSVAL_VOID;
nsScriptSecurityManager::~nsScriptSecurityManager(void) nsScriptSecurityManager::~nsScriptSecurityManager(void)
{ {
delete mOriginToPolicyMap; delete mOriginToPolicyMap;
delete mDefaultPolicy; if(mDefaultPolicy)
mDefaultPolicy->Drop();
delete mCapabilities; delete mCapabilities;
gScriptSecMan = nsnull; gScriptSecMan = nsnull;
} }
@ -2980,8 +2982,10 @@ nsScriptSecurityManager::InitPolicies()
DomainPolicy::InvalidateAll(); DomainPolicy::InvalidateAll();
//-- Release old default policy //-- Release old default policy
if(mDefaultPolicy) if(mDefaultPolicy) {
mDefaultPolicy->Drop(); mDefaultPolicy->Drop();
mDefaultPolicy = nsnull;
}
//-- Initialize a new mOriginToPolicyMap //-- Initialize a new mOriginToPolicyMap
mOriginToPolicyMap = mOriginToPolicyMap =