From 5fdec3f39ea1d8bf3ad532d147fcf4c2440fef38 Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Wed, 14 Sep 2005 20:50:14 +0000 Subject: [PATCH] fixes bug 308370 "nsIncrementalDownload::GetDestination should return a clone of nsIFile" r=biesi, a=mscott git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@180229 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/base/src/nsIncrementalDownload.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mozilla/netwerk/base/src/nsIncrementalDownload.cpp b/mozilla/netwerk/base/src/nsIncrementalDownload.cpp index 06cf4b79047..f643803ff4d 100644 --- a/mozilla/netwerk/base/src/nsIncrementalDownload.cpp +++ b/mozilla/netwerk/base/src/nsIncrementalDownload.cpp @@ -429,8 +429,14 @@ nsIncrementalDownload::GetFinalURI(nsIURI **result) NS_IMETHODIMP nsIncrementalDownload::GetDestination(nsIFile **result) { - NS_IF_ADDREF(*result = mDest); - return NS_OK; + if (!mDest) { + *result = nsnull; + return NS_OK; + } + // Return a clone of mDest so that callers may modify the resulting nsIFile + // without corrupting our internal object. This also works around the fact + // that some nsIFile impls may cache the result of stat'ing the filesystem. + return mDest->Clone(result); } NS_IMETHODIMP