• Philip Chimento's avatar
    fundamental: Fix broken hash table · 105a20a9
    Philip Chimento authored
    There was a hash table (attached to the GjsContext using qdata) which
    stored a mapping of void* fundamental instance pointers to JSObject
    instances. This would have broken quite badly as soon as any of those
    JSObjects were moved by the garbage collector.
    
    Instead we use a JS::GCHashMap, and since it was previously attached to
    the GjsContext anyway we go ahead and make it a member of
    GjsContextPrivate. We put it inside a JS::WeakCache so that it will be
    automatically swept when the objects are garbage collected.
    
    The WeakCache must be destroyed before calling JS_DestroyContext() or we
    will fail an assertion in debug mode.
    105a20a9
fundamental.cpp 17.6 KB