Bug 615149 - Crash under nsAccDocManager::ClearDocCache. r=surkov, a=davidb

This commit is contained in:
Ginn Chen 2010-12-02 11:07:14 -05:00
Родитель c13f3e04fa
Коммит db90450a96
2 изменённых файлов: 20 добавлений и 15 удалений

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

@ -491,17 +491,25 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
// nsAccDocManager static
PLDHashOperator
nsAccDocManager::ClearDocCacheEntry(const nsIDocument* aKey,
nsRefPtr<nsDocAccessible>& aDocAccessible,
void* aUserArg)
nsAccDocManager::GetFirstEntryInDocCache(const nsIDocument* aKey,
nsDocAccessible* aDocAccessible,
void* aUserArg)
{
NS_ASSERTION(aDocAccessible,
"Calling ClearDocCacheEntry with a NULL pointer!");
"No doc accessible for the object in doc accessible cache!");
*reinterpret_cast<nsDocAccessible**>(aUserArg) = aDocAccessible;
if (aDocAccessible)
aDocAccessible->Shutdown();
return PL_DHASH_STOP;
}
return PL_DHASH_REMOVE;
void
nsAccDocManager::ClearDocCache()
{
nsDocAccessible* docAcc = nsnull;
while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast<void*>(&docAcc))) {
if (docAcc)
docAcc->Shutdown();
}
}
PLDHashOperator

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

@ -152,20 +152,17 @@ private:
nsDocAccessibleHashtable;
/**
* Shutdown and remove the document accessible from cache.
* Get first entry of the document accessible from cache.
*/
static PLDHashOperator
ClearDocCacheEntry(const nsIDocument* aKey,
nsRefPtr<nsDocAccessible>& aDocAccessible,
void* aUserArg);
GetFirstEntryInDocCache(const nsIDocument* aKey,
nsDocAccessible* aDocAccessible,
void* aUserArg);
/**
* Clear the cache and shutdown the document accessibles.
*/
void ClearDocCache()
{
mDocAccessibleCache.Enumerate(ClearDocCacheEntry, static_cast<void*>(this));
}
void ClearDocCache();
struct nsSearchAccessibleInCacheArg
{