152224 download manager should addref/release the items it puts into its hashtable

r=varga sr=darin
This commit is contained in:
cbiesinger%web.de 2003-12-19 21:30:26 +00:00
parent 186255512b
commit a65ac517d9

View File

@ -181,9 +181,11 @@ nsresult
nsDownloadManager::DownloadEnded(const nsACString& aTargetPath, const PRUnichar* aMessage)
{
nsCStringKey key(aTargetPath);
if (mCurrDownloads.Exists(&key)) {
nsIDownload* dl = NS_STATIC_CAST(nsIDownload*, mCurrDownloads.Get(&key));
if (dl) {
AssertProgressInfoFor(aTargetPath);
mCurrDownloads.Remove(&key);
NS_RELEASE(dl);
}
return NS_OK;
@ -512,9 +514,13 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
}
nsCStringKey key(utf8Path);
if (mCurrDownloads.Exists(&key))
nsIDownload* dl = NS_STATIC_CAST(nsIDownload*, mCurrDownloads.Get(&key));
if (dl) {
mCurrDownloads.Remove(&key);
NS_RELEASE(dl);
}
NS_ADDREF(*aDownload);
mCurrDownloads.Put(&key, *aDownload);
return rv;