fixes bug 285519 "Shutdown assertions warning about potential dead-locks" r=biesi sr=brendan

This commit is contained in:
darin%meer.net 2005-03-18 08:46:54 +00:00
Родитель 282aafa02e
Коммит 0da9f71117
1 изменённых файлов: 9 добавлений и 2 удалений

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

@ -64,7 +64,14 @@ nsCacheEntryDescriptor::nsCacheEntryDescriptor(nsCacheEntry * entry,
nsCacheEntryDescriptor::~nsCacheEntryDescriptor()
{
Close();
// No need to close if the cache entry has already been severed. This
// helps avoid a shutdown assertion (bug 285519) that is caused when
// consumers end up holding onto these objects past xpcom-shutdown. It's
// okay for them to do that because the cache service calls our Close
// method during xpcom-shutdown, so we don't need to complain about it.
if (mCacheEntry)
Close();
nsCacheService * service = nsCacheService::GlobalInstance();
NS_RELEASE(service);
}
@ -407,7 +414,7 @@ nsCacheEntryDescriptor::Close()
nsAutoLock lock(nsCacheService::ServiceLock());
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
// XXX perhaps closing descriptors should clear/sever transports
// XXX perhaps closing descriptors should clear/sever transports
// tell nsCacheService we're going away
nsCacheService::CloseDescriptor(this);