mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 980419 - Don't access preferences omt in nsMemoryInfoDumper.cpp r=bsmedberg
This commit is contained in:
parent
e9fc16e201
commit
57b5964974
@ -374,6 +374,10 @@ public:
|
||||
class FifoWatcher : public FdWatcher
|
||||
{
|
||||
public:
|
||||
FifoWatcher(nsCString aPath)
|
||||
: mDirPath(aPath)
|
||||
{}
|
||||
|
||||
static void MaybeCreate()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -389,8 +393,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString dirPath;
|
||||
Preferences::GetCString(
|
||||
"memory_info_dumper.watch_fifo.directory", &dirPath);
|
||||
|
||||
// The FifoWatcher is held alive by the observer service.
|
||||
nsRefPtr<FifoWatcher> fw = new FifoWatcher();
|
||||
nsRefPtr<FifoWatcher> fw = new FifoWatcher(dirPath);
|
||||
fw->Init();
|
||||
}
|
||||
|
||||
@ -400,14 +408,12 @@ public:
|
||||
// there. Otherwise, put it into the system's tmp directory.
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsAutoCString dirPath;
|
||||
nsresult rv = Preferences::GetCString(
|
||||
"memory_info_dumper.watch_fifo.directory", &dirPath);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = XRE_GetFileFromPath(dirPath.get(), getter_AddRefs(file));
|
||||
nsresult rv;
|
||||
if (mDirPath.Length() > 0) {
|
||||
rv = XRE_GetFileFromPath(mDirPath.get(), getter_AddRefs(file));
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG("FifoWatcher failed to open file \"%s\"", dirPath.get());
|
||||
LOG("FifoWatcher failed to open file \"%s\"", mDirPath.get());
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -529,6 +535,9 @@ public:
|
||||
LOG("Got unexpected value from fifo; ignoring it.");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoCString mDirPath;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
Loading…
Reference in New Issue
Block a user