From e4ac538c919b3980aeebd2ce82bbc14b646a7495 Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 30 Jan 2021 09:13:13 +0000 Subject: [PATCH] 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. --- source/simulation2/serialization/BinarySerializer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/simulation2/serialization/BinarySerializer.cpp b/source/simulation2/serialization/BinarySerializer.cpp index 31bde63a33..96c88abf42 100644 --- a/source/simulation2/serialization/BinarySerializer.cpp +++ b/source/simulation2/serialization/BinarySerializer.cpp @@ -454,16 +454,18 @@ u32 CBinarySerializerScriptImpl::GetScriptBackrefTag(JS::HandleObject obj) // 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 // 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); ObjectTagMap::Ptr ptr = m_ScriptBackrefTags.lookup(JS::Heap(obj.get())); if (!ptr.found()) { - ENSURE(m_ScriptBackrefTags.put(JS::Heap(obj.get()), ++m_ScriptBackrefsNext)); + if (!m_ScriptBackrefTags.put(JS::Heap(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; }