Bug 479502 - Hold on to a reference to the entry when NotifyExpired is called. r=vlad

The expiration tracker doesn't hold on to references to imgCacheEntries, so if
we're deleting it from the cache, that'll bring its refcount to zero. We
always assume that, when we're calling a function, there exists a reference
that lasts as long as the function does. This patch just makes that true for
the NotifyExpired case.
This commit is contained in:
Joe Drew 2009-02-25 14:09:44 -05:00
Родитель 74bfe47fd0
Коммит 8ce3b9950b
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -482,6 +482,10 @@ imgCacheExpirationTracker::imgCacheExpirationTracker()
void imgCacheExpirationTracker::NotifyExpired(imgCacheEntry *entry)
{
// Hold on to a reference to this entry, because the expiration tracker
// mechanism doesn't.
nsRefPtr<imgCacheEntry> kungFuDeathGrip(entry);
#if defined(PR_LOGGING)
nsRefPtr<imgRequest> req(entry->GetRequest());
if (req) {