• aroben@apple.com's avatar
    Fix <rdar://5578982> ASSERT in... · 390aaf4f
    aroben@apple.com authored
            Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
    
            The bug was due to a mismatch between HashMap::remove and
            HashTable::checkTableConsistency. HashMap::remove can delete the value
            stored in the HashTable (by derefing it), which is not normally
            allowed by HashTable. It's OK in this case because the value is about
            to be removed from the table, but HashTable wasn't aware of this.
    
            HashMap::remove now performs the consistency check itself before
            derefing the value.
    
            Darin noticed that the same bug would occur in HashSet, so I've fixed
            it there as well.
    
            Reviewed by Darin.
    
            * wtf/HashMap.h:
            (WTF::HashMap::remove): Perform the HashTable consistency check
            manually before calling deref.
            * wtf/HashSet.h:
            (WTF::HashSet::remove): Ditto.
            * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
            and HashSet can call it.
            (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
            Added.
            (WTF::HashTable::removeAndInvalidate): Added.
            (WTF::HashTable::remove):
            (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    390aaf4f
HashTable.h 48.2 KB