Bug 391992. nsMathMLOperator statics leak. r=bzbarsky, sr=rbs, a=dbaron

This commit is contained in:
sayrer@gmail.com 2007-08-14 11:42:24 -07:00
parent 89ed6ace4a
commit 4b4f88edfb
2 changed files with 25 additions and 30 deletions

View File

@ -382,27 +382,32 @@ InitGlobals()
rv = InitOperators();
}
}
if (NS_FAILED(rv)) {
if (gInvariantCharArray) {
delete gInvariantCharArray;
gInvariantCharArray = nsnull;
}
if (gOperatorArray) {
delete[] gOperatorArray;
gOperatorArray = nsnull;
}
if (gStretchyOperatorArray) {
delete gStretchyOperatorArray;
gStretchyOperatorArray = nsnull;
}
if (gOperatorTable) {
delete gOperatorTable;
gOperatorTable = nsnull;
}
}
if (NS_FAILED(rv))
nsMathMLOperators::CleanUp();
return rv;
}
void
nsMathMLOperators::CleanUp()
{
if (gInvariantCharArray) {
delete gInvariantCharArray;
gInvariantCharArray = nsnull;
}
if (gOperatorArray) {
delete[] gOperatorArray;
gOperatorArray = nsnull;
}
if (gStretchyOperatorArray) {
delete gStretchyOperatorArray;
gStretchyOperatorArray = nsnull;
}
if (gOperatorTable) {
delete gOperatorTable;
gOperatorTable = nsnull;
}
}
void
nsMathMLOperators::AddRefTable(void)
{
@ -413,18 +418,7 @@ void
nsMathMLOperators::ReleaseTable(void)
{
if (0 == --gTableRefCount) {
if (gOperatorArray) {
delete[] gOperatorArray;
gOperatorArray = nsnull;
}
if (gStretchyOperatorArray) {
delete gStretchyOperatorArray;
gStretchyOperatorArray = nsnull;
}
if (gOperatorTable) {
delete gOperatorTable;
gOperatorTable = nsnull;
}
CleanUp();
}
}

View File

@ -84,6 +84,7 @@ class nsMathMLOperators {
public:
static void AddRefTable(void);
static void ReleaseTable(void);
static void CleanUp();
// LookupOperator:
// Given the string value of an operator and its form (last two bits of flags),