Ticket #4053: fixtrace.patch

File fixtrace.patch, 1.0 KB (added by echotangoecho, 8 years ago)
  • source/scriptinterface/third_party/ObjectToIDMap.h

    class ObjectIdCache  
    3838
    3939public:
    4040    ObjectIdCache(shared_ptr<ScriptRuntime> rt)
    4141        : table_(nullptr), m_rt(rt)
    4242    {
    43         JS_AddExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
    4443    }
    4544
    4645    ~ObjectIdCache()
    4746    {
    4847        if (table_) {
    4948            m_rt->AddDeferredFinalizationObject(std::shared_ptr<void>((void*)table_, DeleteObjectIDTable));
    5049            table_ = nullptr;
     50            JS_RemoveExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
    5151        }
    52 
    53         JS_RemoveExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
    5452    }
    5553
    5654    bool init()
    5755    {
    5856        MOZ_ASSERT(!table_);
    5957        table_ = new ObjectIdTable(js::SystemAllocPolicy());
     58        JS_AddExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
    6059        return table_ && table_->init(32);
    6160    }
    6261
    6362    void trace(JSTracer *trc)
    6463    {