Ignore:
Timestamp:
May 29, 2012, 4:40:26 PM (13 years ago)
Author:
[email protected]
Message:

WeakGCMap should be lazy-finalization-safe
https://bugs.webkit.org/show_bug.cgi?id=87784

Reviewed by Darin Adler.

  • runtime/WeakGCMap.h:

(JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
not Weak<T>, we need to verify manually that the WeakImpl is live before
we return its payload.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/WeakGCMap.h

    r118483 r118856  
    7070    ExternalType get(const KeyType& key) const
    7171    {
    72         return HandleTypes<MappedType>::getFromSlot(const_cast<JSValue*>(&m_map.get(key)->jsValue()));
     72        WeakImpl* impl = m_map.get(key);
     73        if (!impl || impl->state() != WeakImpl::Live)
     74            return ExternalType();
     75        return HandleTypes<MappedType>::getFromSlot(const_cast<JSValue*>(&impl->jsValue()));
    7376    }
    7477
Note: See TracChangeset for help on using the changeset viewer.