1
0
forked from 0ad/0ad

Change ENSURE in BinarySerializer to try and get more debug data.

I'm hoping this will give us more information on what's going wrong.

Also remove comments which were outdated since 7460d0e56e

Refs #5987

Differential Revision: https://code.wildfiregames.com/D3501
This was SVN commit r24811.
This commit is contained in:
wraitii 2021-01-30 09:13:13 +00:00
parent 11ed0fd619
commit e4ac538c91

View File

@ -454,16 +454,18 @@ u32 CBinarySerializerScriptImpl::GetScriptBackrefTag(JS::HandleObject obj)
// to indicate multiple references to one object(/array). So every time we serialize a // to indicate multiple references to one object(/array). So every time we serialize a
// new object, we give it a new tag; when we serialize it a second time we just refer // new object, we give it a new tag; when we serialize it a second time we just refer
// to that tag. // to that tag.
//
// Tags are stored on the object. To avoid overwriting any existing property,
// they are saved as a uniquely-named, non-enumerable property (the serializer's unique symbol).
ScriptRequest rq(m_ScriptInterface); ScriptRequest rq(m_ScriptInterface);
ObjectTagMap::Ptr ptr = m_ScriptBackrefTags.lookup(JS::Heap<JSObject*>(obj.get())); ObjectTagMap::Ptr ptr = m_ScriptBackrefTags.lookup(JS::Heap<JSObject*>(obj.get()));
if (!ptr.found()) if (!ptr.found())
{ {
ENSURE(m_ScriptBackrefTags.put(JS::Heap<JSObject*>(obj.get()), ++m_ScriptBackrefsNext)); if (!m_ScriptBackrefTags.put(JS::Heap<JSObject*>(obj.get()), ++m_ScriptBackrefsNext))
{
JS::RootedValue objval(rq.cx, JS::ObjectValue(*obj.get()));
LOGERROR("BinarySerializer: error at insertion. Object was %s", m_ScriptInterface.ToString(&objval));
return 0;
}
// Return 0 to mean "you have to serialize this object"; // Return 0 to mean "you have to serialize this object";
return 0; return 0;
} }