aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-24 14:00:00 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-24 14:00:23 +1000
commit9f43d27b4377b1d3e166657a608dad91668c7909 (patch)
tree133dbda6acdfe7f761bbf618c2c164f62d610672
parent412b24a06c681a03ab1c1f84e00142cab40bf602 (diff)
downloadfengari-9f43d27b4377b1d3e166657a608dad91668c7909.tar.gz
fengari-9f43d27b4377b1d3e166657a608dad91668c7909.tar.bz2
fengari-9f43d27b4377b1d3e166657a608dad91668c7909.zip
src/ltable.js: Use a valid weakmap key for lightuserdata object hash
-rw-r--r--src/ltable.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ltable.js b/src/ltable.js
index b408cd1..df2d4f7 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -15,7 +15,9 @@ let lightuserdata_hashes = new WeakMap();
const get_lightuserdata_hash = function(v) {
let hash = lightuserdata_hashes.get(v);
if (!hash) {
- hash = Symbol("lightuserdata");
+ /* Hash should be something unique that is a valid WeakMap key
+ so that it ends up in dead_weak when removed from a table */
+ hash = {};
lightuserdata_hashes.set(v, hash);
}
return hash;