mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
152224 download manager should addref/release the items it puts into its hashtable
r=varga sr=darin
This commit is contained in:
parent
186255512b
commit
a65ac517d9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user