mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Disconnect and release the event listener manager after removing the entry from the hash table to avoid crashes caused re-entry into hash table code. b=334177 r+sr=jst
This commit is contained in:
parent
ef4cd3ad5a
commit
9b0fa55141
@ -203,9 +203,7 @@ public:
|
||||
|
||||
~EventListenerManagerMapEntry()
|
||||
{
|
||||
if (mListenerManager) {
|
||||
mListenerManager->Disconnect();
|
||||
}
|
||||
NS_ASSERTION(!mListenerManager, "caller must release and disconnect ELM");
|
||||
}
|
||||
|
||||
private:
|
||||
@ -2887,8 +2885,20 @@ void
|
||||
nsContentUtils::RemoveListenerManager(nsIContent *aContent)
|
||||
{
|
||||
if (sEventListenerManagersHash.ops) {
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aContent,
|
||||
PL_DHASH_REMOVE);
|
||||
EventListenerManagerMapEntry *entry =
|
||||
NS_STATIC_CAST(EventListenerManagerMapEntry *,
|
||||
PL_DHashTableOperate(&sEventListenerManagersHash, aContent,
|
||||
PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
nsCOMPtr<nsIEventListenerManager> listenerManager;
|
||||
listenerManager.swap(entry->mListenerManager);
|
||||
// Remove the entry and *then* do operations that could cause further
|
||||
// modification of sEventListenerManagersHash. See bug 334177.
|
||||
PL_DHashTableRawRemove(&sEventListenerManagersHash, entry);
|
||||
if (listenerManager) {
|
||||
listenerManager->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user