Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize...
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 06:44:26 +0000 (06:44 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 06:44:26 +0000 (06:44 +0000)
commit14cd8a297972f8b669b43eff7bd3050ff5f6c85d
treed3cb0ce7674791b4d953b5b4d0d3af9fafe85041
parent820b91f1a2ba3e46d3bb66ba3014b323ebba53be
    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: https://svn.webkit.org/repository/webkit/trunk@27710 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/wtf/HashMap.h
JavaScriptCore/wtf/HashSet.h
JavaScriptCore/wtf/HashTable.h