Change finalization of event listener manager hash to deal with interactions with preserved wrapper table and dangling pointers. b=325279 r=bzbarsky sr=jst

git-svn-id: svn://10.0.0.236/trunk@190421 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2006-02-17 23:41:44 +00:00
parent 8fd71929dc
commit 9352850db6

View File

@@ -643,18 +643,16 @@ nsContentUtils::Shutdown()
// See comment above.
// Copy the ops out of the hash table
PLDHashTableOps hash_table_ops = *sEventListenerManagersHash.ops;
// However, we have to handle this table differently. If it still
// has entries, we want to leak it too, so that we can keep it alive
// in case any elements are destroyed. Because if they are, we need
// their event listener managers to be destroyed too, or otherwise
// it could leave dangling references in DOMClassInfo's preserved
// wrapper table.
// Set the clearEntry hook to be a nop
hash_table_ops.clearEntry = NopClearEntry;
// Set the ops in the hash table to be the new ops
sEventListenerManagersHash.ops = &hash_table_ops;
PL_DHashTableFinish(&sEventListenerManagersHash);
sEventListenerManagersHash.ops = nsnull;
if (sEventListenerManagersHash.entryCount == 0) {
PL_DHashTableFinish(&sEventListenerManagersHash);
}
}
}