Bug 217967 FF104 crash [@ PL_DHashTableOperate ] changing caps access control prefs

More consistent DomainPolicy lifecycle management avoids use of corrupted hashtable data
patch by g.maone@informaction.com r=dveditz sr=shaver a=bsmedberg


git-svn-id: svn://10.0.0.236/trunk@175300 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timeless%mozdev.org
2005-06-29 16:29:49 +00:00
parent 7d3cdb0ddc
commit fa1982b341
4 changed files with 82 additions and 14 deletions

View File

@@ -259,6 +259,13 @@ public:
DomainPolicy() : mWildcardPolicy(nsnull),
mRefCount(0)
{
mGeneration = sGeneration;
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
++sObjects;
_printPopulationInfo();
#endif
}
PRBool Init()
@@ -283,6 +290,12 @@ public:
~DomainPolicy()
{
PL_DHashTableFinish(this);
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
--sObjects;
_printPopulationInfo();
#endif
}
void Hold()
@@ -295,11 +308,29 @@ public:
if (--mRefCount == 0)
delete this;
}
static void InvalidateAll()
{
sGeneration++;
}
PRBool IsInvalid()
{
return mGeneration != sGeneration;
}
ClassPolicy* mWildcardPolicy;
private:
PRUint32 mRefCount;
PRUint32 mGeneration;
static PRUint32 sGeneration;
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
static PRUint32 sObjects;
static void _printPopulationInfo();
#endif
};
/////////////////////////////