Fix two issues in WeakTable.java that can lead to infinite loops.

This commit is contained in:
Ian Farmer
2011-09-27 04:06:21 +00:00
parent b769c61e0f
commit 3a266748be
2 changed files with 60 additions and 3 deletions

View File

@@ -178,7 +178,7 @@ public class WeakTable extends LuaTable {
return 0;
}
else {
if ( k.raweq(key) )
if ( k.raweq(key.strongkey()) )
return i;
i = ( i + 1 ) % hashKeys.length;
}
@@ -204,7 +204,7 @@ public class WeakTable extends LuaTable {
LuaValue ks = k.strongkey();
LuaValue vs = n.arg(2).strongvalue();
if ( ks.isnil() || vs.isnil() ) {
super.rawset(ks, NIL);
super.rawset(k, NIL);
} else {
return varargsOf(ks,vs);
}