Fix incorrect use of nsSupportsHashTable that was causing leakage.

This commit is contained in:
waterson%netscape.com 1999-11-23 22:02:57 +00:00
Родитель 0eb37c639b
Коммит faa4cf33a1
2 изменённых файлов: 12 добавлений и 22 удалений

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

@ -478,12 +478,10 @@ NS_IMETHODIMP nsChromeRegistry::GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFD
overlayFile += "overlays.rdf"; overlayFile += "overlays.rdf";
nsStringKey skey(overlayFile); nsStringKey skey(overlayFile);
void *data = mDataSourceTable->Get(&skey); nsCOMPtr<nsISupports> supports = getter_AddRefs(NS_STATIC_CAST(nsISupports*, mDataSourceTable->Get(&skey)));
if (data) if (supports)
{ {
nsCOMPtr<nsIRDFDataSource> dataSource; nsCOMPtr<nsIRDFDataSource> dataSource = do_QueryInterface(supports, &rv);
nsISupports *supports = NS_STATIC_CAST(nsISupports*, data);
dataSource = do_QueryInterface(supports, &rv);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
*aResult = dataSource; *aResult = dataSource;
@ -600,13 +598,10 @@ nsChromeRegistry::InitializeDataSource(nsString &aPackage,
{ {
// current.rdf and overlays.rdf are loaded in pairs and so if one is loaded, the other should be too. // current.rdf and overlays.rdf are loaded in pairs and so if one is loaded, the other should be too.
nsStringKey skey(chromeFile); nsStringKey skey(chromeFile);
void *data = mDataSourceTable->Get(&skey); nsCOMPtr<nsISupports> supports = getter_AddRefs(NS_STATIC_CAST(nsISupports*, mDataSourceTable->Get(&skey)));
if (data) if (supports)
{ {
nsCOMPtr<nsIRDFDataSource> dataSource; nsCOMPtr<nsIRDFDataSource> dataSource = do_QueryInterface(supports);
nsISupports *supports = NS_STATIC_CAST(nsISupports*, data);
dataSource = do_QueryInterface(supports);
if (dataSource) if (dataSource)
{ {
*aResult = dataSource; *aResult = dataSource;

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

@ -478,12 +478,10 @@ NS_IMETHODIMP nsChromeRegistry::GetOverlayDataSource(nsIURI *aChromeURL, nsIRDFD
overlayFile += "overlays.rdf"; overlayFile += "overlays.rdf";
nsStringKey skey(overlayFile); nsStringKey skey(overlayFile);
void *data = mDataSourceTable->Get(&skey); nsCOMPtr<nsISupports> supports = getter_AddRefs(NS_STATIC_CAST(nsISupports*, mDataSourceTable->Get(&skey)));
if (data) if (supports)
{ {
nsCOMPtr<nsIRDFDataSource> dataSource; nsCOMPtr<nsIRDFDataSource> dataSource = do_QueryInterface(supports, &rv);
nsISupports *supports = NS_STATIC_CAST(nsISupports*, data);
dataSource = do_QueryInterface(supports, &rv);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
*aResult = dataSource; *aResult = dataSource;
@ -600,13 +598,10 @@ nsChromeRegistry::InitializeDataSource(nsString &aPackage,
{ {
// current.rdf and overlays.rdf are loaded in pairs and so if one is loaded, the other should be too. // current.rdf and overlays.rdf are loaded in pairs and so if one is loaded, the other should be too.
nsStringKey skey(chromeFile); nsStringKey skey(chromeFile);
void *data = mDataSourceTable->Get(&skey); nsCOMPtr<nsISupports> supports = getter_AddRefs(NS_STATIC_CAST(nsISupports*, mDataSourceTable->Get(&skey)));
if (data) if (supports)
{ {
nsCOMPtr<nsIRDFDataSource> dataSource; nsCOMPtr<nsIRDFDataSource> dataSource = do_QueryInterface(supports);
nsISupports *supports = NS_STATIC_CAST(nsISupports*, data);
dataSource = do_QueryInterface(supports);
if (dataSource) if (dataSource)
{ {
*aResult = dataSource; *aResult = dataSource;