fixed bug17388, dtd leak; r=mscott

This commit is contained in:
rickg%netscape.com 1999-10-28 07:53:21 +00:00
Родитель 0caca08867
Коммит 683fc55f15
6 изменённых файлов: 42 добавлений и 16 удалений

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

@ -89,7 +89,7 @@ public:
class CSharedParserObjects { class CSharedParserObjects {
public: public:
CSharedParserObjects() : mDTDDeque(new CDTDDeallocator()) { CSharedParserObjects() : mDTDDeque(0) {
nsIDTD* theDTD; nsIDTD* theDTD;
@ -104,6 +104,8 @@ public:
} }
~CSharedParserObjects() { ~CSharedParserObjects() {
CDTDDeallocator theDeallocator;
mDTDDeque.ForEach(theDeallocator); //release all the DTD's
} }
void RegisterDTD(nsIDTD* aDTD){ void RegisterDTD(nsIDTD* aDTD){
@ -119,10 +121,6 @@ public:
} }
} }
nsIDTD* FindDTD(nsIDTD* aDTD){
return 0;
}
nsDeque mDTDDeque; nsDeque mDTDDeque;
}; };
@ -175,6 +173,18 @@ CSharedParserObjects& GetSharedObjects() {
return *gSharedParserObjects; return *gSharedParserObjects;
} }
/**
* This gets called when the htmlparser module is shutdown.
*
* @update gess 01/04/99
*/
void nsParser::FreeSharedObjects(void) {
if (gSharedParserObjects) {
delete gSharedParserObjects;
gSharedParserObjects=0;
}
}
/** /**
* default constructor * default constructor
* *

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

@ -83,9 +83,12 @@ class nsIProgressEventSink;
CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener { CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
public: public:
friend class CTokenHandler;
friend class CTokenHandler;
static void FreeSharedObjects(void);
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -400,6 +403,5 @@ public:
}; };
#endif #endif

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

@ -187,6 +187,7 @@ nsParserModule::Shutdown()
nsHTMLTokenizer::FreeTokenRecycler(); nsHTMLTokenizer::FreeTokenRecycler();
nsXMLTokenizer::FreeTokenRecycler(); nsXMLTokenizer::FreeTokenRecycler();
nsExpatTokenizer::FreeTokenRecycler(); nsExpatTokenizer::FreeTokenRecycler();
nsParser::FreeSharedObjects();
mInitialized = PR_FALSE; mInitialized = PR_FALSE;
} }
} }

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

@ -89,7 +89,7 @@ public:
class CSharedParserObjects { class CSharedParserObjects {
public: public:
CSharedParserObjects() : mDTDDeque(new CDTDDeallocator()) { CSharedParserObjects() : mDTDDeque(0) {
nsIDTD* theDTD; nsIDTD* theDTD;
@ -104,6 +104,8 @@ public:
} }
~CSharedParserObjects() { ~CSharedParserObjects() {
CDTDDeallocator theDeallocator;
mDTDDeque.ForEach(theDeallocator); //release all the DTD's
} }
void RegisterDTD(nsIDTD* aDTD){ void RegisterDTD(nsIDTD* aDTD){
@ -119,10 +121,6 @@ public:
} }
} }
nsIDTD* FindDTD(nsIDTD* aDTD){
return 0;
}
nsDeque mDTDDeque; nsDeque mDTDDeque;
}; };
@ -175,6 +173,18 @@ CSharedParserObjects& GetSharedObjects() {
return *gSharedParserObjects; return *gSharedParserObjects;
} }
/**
* This gets called when the htmlparser module is shutdown.
*
* @update gess 01/04/99
*/
void nsParser::FreeSharedObjects(void) {
if (gSharedParserObjects) {
delete gSharedParserObjects;
gSharedParserObjects=0;
}
}
/** /**
* default constructor * default constructor
* *

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

@ -83,9 +83,12 @@ class nsIProgressEventSink;
CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener { CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener {
public: public:
friend class CTokenHandler;
friend class CTokenHandler;
static void FreeSharedObjects(void);
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -400,6 +403,5 @@ public:
}; };
#endif #endif

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

@ -187,6 +187,7 @@ nsParserModule::Shutdown()
nsHTMLTokenizer::FreeTokenRecycler(); nsHTMLTokenizer::FreeTokenRecycler();
nsXMLTokenizer::FreeTokenRecycler(); nsXMLTokenizer::FreeTokenRecycler();
nsExpatTokenizer::FreeTokenRecycler(); nsExpatTokenizer::FreeTokenRecycler();
nsParser::FreeSharedObjects();
mInitialized = PR_FALSE; mInitialized = PR_FALSE;
} }
} }