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