Bug 49813 "threadsafe" nsDirectoryIndexStream uses nsDirEnumeratorUnix triggering "not thread-safe" assertion

r=darin sr=darin
This commit is contained in:
timeless%mozdev.org 2003-11-05 12:39:05 +00:00
Родитель 04585b8515
Коммит 4b3b30a355
2 изменённых файлов: 8 добавлений и 5 удалений

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

@ -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<nsISimpleEnumerator> 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');

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

@ -51,7 +51,6 @@ protected:
nsCAutoString mBuf;
PRInt32 mOffset;
nsCOMPtr<nsIFile> mDir;
PRInt32 mPos;
nsVoidArray mArray;
@ -61,10 +60,16 @@ protected:
nsCOMPtr<nsITextToSubURI> 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);