Fix a possible source of segmentation fault in our custom version of ObjectIdCache.
Patch by echotangoecho, refs #4053 This was SVN commit r18757.
This commit is contained in:
parent
fd8f689f35
commit
172c222e9b
@ -37,7 +37,6 @@ public:
|
||||
ObjectIdCache(shared_ptr<ScriptRuntime> rt)
|
||||
: table_(nullptr), m_rt(rt)
|
||||
{
|
||||
JS_AddExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
|
||||
}
|
||||
|
||||
~ObjectIdCache()
|
||||
@ -46,9 +45,8 @@ public:
|
||||
{
|
||||
m_rt->AddDeferredFinalizationObject(std::shared_ptr<void>((void*)table_, DeleteTable));
|
||||
table_ = nullptr;
|
||||
JS_RemoveExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
|
||||
}
|
||||
|
||||
JS_RemoveExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
|
||||
}
|
||||
|
||||
bool init()
|
||||
@ -57,6 +55,7 @@ public:
|
||||
return true;
|
||||
|
||||
table_ = new Table(js::SystemAllocPolicy());
|
||||
JS_AddExtraGCRootsTracer(m_rt->m_rt, ObjectIdCache::Trace, this);
|
||||
return table_ && table_->init(32);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user