Bug 196917. Crash in nsDiskCacheMap::FindRecord clearing cache. patch by Gordon Sheridan <gordon@netscape.com> r=dougt@netscape.com, sr=darin@netscape.com, a=asa@mozilla.org

This commit is contained in:
stephend%netscape.com 2003-05-23 05:44:15 +00:00
Родитель 2f9ea6e59b
Коммит fa29e34049
2 изменённых файлов: 9 добавлений и 5 удалений

8
netwerk/cache/src/nsCacheService.cpp поставляемый
Просмотреть файл

@ -1109,14 +1109,14 @@ nsCacheService::OnProfileShutdown(PRBool cleanse)
if (!gService) return;
nsAutoLock lock(gService->mCacheServiceLock);
gService->DoomActiveEntries();
gService->ClearDoomList();
#ifdef NECKO_DISK_CACHE
if (gService->mDiskDevice) {
if (gService->mDiskDevice && gService->mEnableDiskDevice) {
if (cleanse)
gService->mDiskDevice->EvictEntries(nsnull);
gService->DoomActiveEntries();
gService->ClearDoomList();
gService->mDiskDevice->Shutdown();
gService->mEnableDiskDevice = PR_FALSE;
}

6
netwerk/cache/src/nsDiskCacheDevice.cpp поставляемый
Просмотреть файл

@ -414,6 +414,7 @@ nsDiskCacheDevice::GetDeviceID()
nsCacheEntry *
nsDiskCacheDevice::FindEntry(nsCString * key)
{
if (!Initialized()) return nsnull; // NS_ERROR_NOT_INITIALIZED
nsresult rv;
nsDiskCacheRecord record;
nsCacheEntry * entry = nsnull;
@ -502,6 +503,7 @@ nsDiskCacheDevice::DeactivateEntry(nsCacheEntry * entry)
nsresult
nsDiskCacheDevice::BindEntry(nsCacheEntry * entry)
{
if (!Initialized()) return NS_ERROR_NOT_INITIALIZED;
nsresult rv = NS_OK;
nsDiskCacheRecord record, oldRecord;
@ -746,6 +748,7 @@ private:
nsresult
nsDiskCacheDevice::Visit(nsICacheVisitor * visitor)
{
if (!Initialized()) return NS_ERROR_NOT_INITIALIZED;
nsDiskCacheDeviceInfo* deviceInfo = new nsDiskCacheDeviceInfo(this);
nsCOMPtr<nsICacheDeviceInfo> ref(deviceInfo);
@ -765,12 +768,13 @@ nsDiskCacheDevice::Visit(nsICacheVisitor * visitor)
nsresult
nsDiskCacheDevice::EvictEntries(const char * clientID)
{
if (!Initialized()) return NS_ERROR_NOT_INITIALIZED;
nsresult rv;
if (clientID == nsnull) {
// we're clearing the entire disk cache
rv = ClearDiskCache();
if (NS_SUCCEEDED(rv) || (rv != NS_ERROR_CACHE_IN_USE))
if (rv != NS_ERROR_CACHE_IN_USE)
return rv;
}