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:
alecf%netscape.com 2002-03-16 05:30:15 +00:00
Родитель 58a43e4b0d
Коммит ac827509dc
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -654,9 +654,13 @@ 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);