Bug 839673 - Do not access the ArenaHeader of already-finalized GCThings; r=luke

This commit is contained in:
Terrence Cole
2013-02-12 17:48:10 -08:00
parent 427fd2f41b
commit a1db4796d1
6 changed files with 45 additions and 7 deletions

View File

@@ -373,6 +373,11 @@ WeakMap_finalize(FreeOp *fop, RawObject obj)
{
if (ObjectValueMap *map = GetObjectMap(obj)) {
map->check();
/*
* The map may contain finalized entries, so drop them before destructing to avoid calling
* ~EncapsulatedPtr.
*/
map->clearWithoutCallingDestructors();
#ifdef DEBUG
map->~ObjectValueMap();
memset(static_cast<void *>(map), 0xdc, sizeof(*map));