fixes bug 325948 "crash quiting application while a download is in progress" r=mconnor

This commit is contained in:
darin%meer.net 2006-02-07 01:26:14 +00:00
Родитель d9c10a953d
Коммит 9060693865
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -66,6 +66,7 @@
#include "nsIFileURL.h"
#include "nsEmbedCID.h"
#include "nsInt64.h"
#include "nsAutoPtr.h"
/* Outstanding issues/todo:
* 1. Implement pause/resume.
@ -709,7 +710,10 @@ nsDownloadManager::CancelDownload(const PRUnichar* aPath)
if (!mCurrDownloads.Exists(&key))
return RemoveDownload(aPath); // XXXBlake for now, to provide a workaround for stuck downloads
nsDownload* internalDownload = NS_STATIC_CAST(nsDownload*, mCurrDownloads.Get(&key));
// Take a strong reference to the download object as we may remove it from
// mCurrDownloads in DownloadEnded.
nsRefPtr<nsDownload> internalDownload =
NS_STATIC_CAST(nsDownload*, mCurrDownloads.Get(&key));
if (!internalDownload)
return NS_ERROR_FAILURE;
@ -1811,8 +1815,8 @@ nsDownload::nsDownload():mDownloadState(nsIDownloadManager::DOWNLOAD_NOTSTARTED)
mCurrBytes(LL_ZERO),
mMaxBytes(LL_ZERO),
mStartTime(LL_ZERO),
mSpeed(0),
mLastUpdate(PR_Now() - (PRUint32)gInterval)
mLastUpdate(PR_Now() - (PRUint32)gInterval),
mSpeed(0)
{
}