From f2b469b08bea69844c29d10f0631e754f6d9230f Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Fri, 2 Apr 2004 23:48:18 +0000 Subject: [PATCH] fixing hpux bustage, bug 239465, r=dbaron git-svn-id: svn://10.0.0.236/trunk@154465 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsLocalFileUnix.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mozilla/xpcom/io/nsLocalFileUnix.cpp b/mozilla/xpcom/io/nsLocalFileUnix.cpp index d1515e489eb..2b8cf06c100 100644 --- a/mozilla/xpcom/io/nsLocalFileUnix.cpp +++ b/mozilla/xpcom/io/nsLocalFileUnix.cpp @@ -893,10 +893,12 @@ nsLocalFile::Remove(PRBool recursive) InvalidateCache(); if (isDir) { if (recursive) { - nsCOMPtr dir = new nsDirEnumeratorUnix(); + nsDirEnumeratorUnix *dir = new nsDirEnumeratorUnix(); if (!dir) return NS_ERROR_OUT_OF_MEMORY; + nsCOMPtr dirRef(dir); // release on exit + rv = dir->Init(this, PR_FALSE); if (NS_FAILED(rv)) return rv; @@ -1498,17 +1500,20 @@ nsLocalFile::SetFollowLinks(PRBool aFollowLinks) NS_IMETHODIMP nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator **entries) { - nsCOMPtr dir = new nsDirEnumeratorUnix(); + nsDirEnumeratorUnix *dir = new nsDirEnumeratorUnix(); if (!dir) return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(dir); nsresult rv = dir->Init(this, PR_FALSE); - if (NS_FAILED(rv)) - return rv; + if (NS_FAILED(rv)) { + *entries = nsnull; + NS_RELEASE(dir); + } else { + *entries = dir; // transfer reference + } - /* QI needed? If not, need to ADDREF. */ - return dir->QueryInterface(NS_GET_IID(nsISimpleEnumerator), - (void **)entries); + return rv; } NS_IMETHODIMP