Clean up memory leaks.
This commit is contained in:
dougt%netscape.com 2000-07-27 06:14:06 +00:00
parent 9bfe3f2e81
commit 920f29e288
2 changed files with 40 additions and 0 deletions

View File

@ -252,8 +252,28 @@ nsChromeRegistry::nsChromeRegistry()
}
}
static PRBool DatasourceEnumerator(nsHashKey *aKey, void *aData, void* closure)
{
if (!closure || !aData)
return PR_FALSE;
nsIRDFCompositeDataSource* compositeDS = (nsIRDFCompositeDataSource*) closure;
nsCOMPtr<nsISupports> supports = (nsISupports*)aData;
nsCOMPtr<nsIRDFDataSource> dataSource = do_QueryInterface(supports);
if (!dataSource)
return PR_FALSE;
compositeDS->RemoveDataSource(dataSource);
return PR_TRUE;
}
nsChromeRegistry::~nsChromeRegistry()
{
mDataSourceTable->Enumerate(DatasourceEnumerator, mChromeDataSource);
delete mDataSourceTable;
if (mRDFService) {

View File

@ -252,8 +252,28 @@ nsChromeRegistry::nsChromeRegistry()
}
}
static PRBool DatasourceEnumerator(nsHashKey *aKey, void *aData, void* closure)
{
if (!closure || !aData)
return PR_FALSE;
nsIRDFCompositeDataSource* compositeDS = (nsIRDFCompositeDataSource*) closure;
nsCOMPtr<nsISupports> supports = (nsISupports*)aData;
nsCOMPtr<nsIRDFDataSource> dataSource = do_QueryInterface(supports);
if (!dataSource)
return PR_FALSE;
compositeDS->RemoveDataSource(dataSource);
return PR_TRUE;
}
nsChromeRegistry::~nsChromeRegistry()
{
mDataSourceTable->Enumerate(DatasourceEnumerator, mChromeDataSource);
delete mDataSourceTable;
if (mRDFService) {