mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
fix for bug 124497 - leaking nsLocalFile objects - the copy constructor was copying the refcount to the new object
so the new object would always leak r=dbradley, sr=darin, a=asa
This commit is contained in:
parent
523eb4e6a8
commit
f9de1f9460
@ -654,10 +654,14 @@ nsLocalFile::Clone(nsIFile **file)
|
||||
*file = nsnull;
|
||||
|
||||
// Just copy-construct ourselves
|
||||
nsCOMPtr<nsILocalFile> localFile = new nsLocalFile(*this);
|
||||
nsLocalFile *localFile = new nsLocalFile(*this);
|
||||
if (localFile == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// don't forget to re-initialize mRefCnt
|
||||
// or the new object will have the old refcnt
|
||||
localFile->mRefCnt = 0;
|
||||
|
||||
*file = localFile;
|
||||
NS_ADDREF(*file);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user