Also erase the value of the list node itself when deleting it inside kDeleteKey, as it might be referenced again before the GC is invoked

svn-id: r50516
This commit is contained in:
Filippos Karapetis 2010-06-30 07:28:30 +00:00
parent 9f1413b338
commit 7c5b31eb6d

View File

@ -346,9 +346,11 @@ reg_t kDeleteKey(EngineState *s, int argc, reg_t *argv) {
if (!n->succ.isNull())
s->_segMan->lookupNode(n->succ)->pred = n->pred;
// Erase references to the predecessor and successor nodes
// Erase the node itself, as the game might reference it
// again before the GC is invoked
n->pred = NULL_REG;
n->succ = NULL_REG;
n->value = NULL_REG;
return make_reg(0, 1); // Signal success
}