diff --git a/netwerk/base/src/nsDirectoryIndexStream.cpp b/netwerk/base/src/nsDirectoryIndexStream.cpp index f1943fa00646..83ec5c7e5f42 100644 --- a/netwerk/base/src/nsDirectoryIndexStream.cpp +++ b/netwerk/base/src/nsDirectoryIndexStream.cpp @@ -165,12 +165,10 @@ nsDirectoryIndexStream::Init(nsIFile* aDir) } #endif - mDir = aDir; - // Sigh. We have to allocate on the heap because there are no // assignment operators defined. nsCOMPtr iter; - rv = mDir->GetDirectoryEntries(getter_AddRefs(iter)); + rv = aDir->GetDirectoryEntries(getter_AddRefs(iter)); if (NS_FAILED(rv)) return rv; // Now lets sort, because clients expect it that way @@ -215,7 +213,7 @@ nsDirectoryIndexStream::Init(nsIFile* aDir) mBuf.Append("300: "); nsCAutoString url; - rv = net_GetURLSpecFromFile(mDir, url); + rv = net_GetURLSpecFromFile(aDir, url); if (NS_FAILED(rv)) return rv; mBuf.Append(url); mBuf.Append('\n'); diff --git a/netwerk/base/src/nsDirectoryIndexStream.h b/netwerk/base/src/nsDirectoryIndexStream.h index 6e6a3341cd2d..4236b551c051 100644 --- a/netwerk/base/src/nsDirectoryIndexStream.h +++ b/netwerk/base/src/nsDirectoryIndexStream.h @@ -51,7 +51,6 @@ protected: nsCAutoString mBuf; PRInt32 mOffset; - nsCOMPtr mDir; PRInt32 mPos; nsVoidArray mArray; @@ -61,10 +60,16 @@ protected: nsCOMPtr mTextToSubURI; nsDirectoryIndexStream(); + /** + * aDir will only be used on the calling thread. + */ nsresult Init(nsIFile* aDir); virtual ~nsDirectoryIndexStream(); public: + /** + * aDir will only be used on the calling thread. + */ static nsresult Create(nsIFile* aDir, nsIInputStream** aStreamResult);