Fix one-time leak of 4 nsVoidArray and 1 PRMonitor from code in nsRange.cpp by freeing in layout module destructor. r=mjudge@netscape.com sr=scc@mozilla.org b=56762

git-svn-id: svn://10.0.0.236/trunk@81990 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%fas.harvard.edu 2000-10-29 21:38:52 +00:00
parent 42fb5fdb76
commit b317a6d07b
5 changed files with 51 additions and 0 deletions

View File

@ -293,6 +293,27 @@ nsRange::~nsRange()
// note that "nsCOMPtr<nsIDOMmNode>()" is the moral equivalent of null
}
// for layout module destructor
void nsRange::Shutdown()
{
if (mMonitor) {
PR_DestroyMonitor(mMonitor);
mMonitor = nsnull;
}
delete mStartAncestors;
mStartAncestors = nsnull;
delete mEndAncestors;
mEndAncestors = nsnull;
delete mStartAncestorOffsets;
mStartAncestorOffsets = nsnull;
delete mEndAncestorOffsets;
mEndAncestorOffsets = nsnull;
}
/******************************************************
* nsISupports
******************************************************/

View File

@ -47,6 +47,9 @@ public:
nsRange();
virtual ~nsRange();
// for layout module destructor
static void Shutdown();
// nsIDOMRange interface
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned);

View File

@ -293,6 +293,27 @@ nsRange::~nsRange()
// note that "nsCOMPtr<nsIDOMmNode>()" is the moral equivalent of null
}
// for layout module destructor
void nsRange::Shutdown()
{
if (mMonitor) {
PR_DestroyMonitor(mMonitor);
mMonitor = nsnull;
}
delete mStartAncestors;
mStartAncestors = nsnull;
delete mEndAncestors;
mEndAncestors = nsnull;
delete mStartAncestorOffsets;
mStartAncestorOffsets = nsnull;
delete mEndAncestorOffsets;
mEndAncestorOffsets = nsnull;
}
/******************************************************
* nsISupports
******************************************************/

View File

@ -47,6 +47,9 @@ public:
nsRange();
virtual ~nsRange();
// for layout module destructor
static void Shutdown();
// nsIDOMRange interface
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned);

View File

@ -68,6 +68,7 @@
#include "nsIServiceManager.h"
#include "nsTextTransformer.h"
#include "nsRange.h"
#include "nsIHTTPProtocolHandler.h"
#include "gbdate.h"
#include "nsContentPolicyUtils.h"
@ -276,6 +277,8 @@ nsLayoutModule::Shutdown()
nsTextTransformer::Shutdown();
nsRange::Shutdown();
NS_IF_RELEASE(gRegistry);
NS_IF_RELEASE(gUAStyleSheet);
}