Bug 971975 - Proper state and non-null check for CacheFile::WriteMetadataIfNeededLocked(), r=michal
This commit is contained in:
@@ -177,9 +177,11 @@ CacheFile::~CacheFile()
|
|||||||
LOG(("CacheFile::~CacheFile() [this=%p]", this));
|
LOG(("CacheFile::~CacheFile() [this=%p]", this));
|
||||||
|
|
||||||
MutexAutoLock lock(mLock);
|
MutexAutoLock lock(mLock);
|
||||||
if (!mMemoryOnly)
|
if (!mMemoryOnly && mReady) {
|
||||||
|
// mReady flag indicates we have metadata plus in a valid state.
|
||||||
WriteMetadataIfNeededLocked(true);
|
WriteMetadataIfNeededLocked(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CacheFile::Init(const nsACString &aKey,
|
CacheFile::Init(const nsACString &aKey,
|
||||||
@@ -1335,6 +1337,11 @@ CacheFile::WriteMetadataIfNeededLocked(bool aFireAndForget)
|
|||||||
AssertOwnsLock();
|
AssertOwnsLock();
|
||||||
MOZ_ASSERT(!mMemoryOnly);
|
MOZ_ASSERT(!mMemoryOnly);
|
||||||
|
|
||||||
|
if (!mMetadata) {
|
||||||
|
MOZ_CRASH("Must have metadata here");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!aFireAndForget) {
|
if (!aFireAndForget) {
|
||||||
// if aFireAndForget is set, we are called from dtor. Write
|
// if aFireAndForget is set, we are called from dtor. Write
|
||||||
// scheduler hard-refers CacheFile otherwise, so we cannot be here.
|
// scheduler hard-refers CacheFile otherwise, so we cannot be here.
|
||||||
|
|||||||
Reference in New Issue
Block a user