about summary refs log tree commit diff stats
path: root/src/js/javascript.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r--src/js/javascript.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index 2266a3c7..44c7ef06 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -180,6 +180,15 @@ proc free*(ctx: JSContext) =
 proc free*(rt: JSRuntime) =
   let opaque = rt.getOpaque()
   GC_unref(opaque)
+  var ps: seq[pointer] = @[]
+  for p in opaque.plist.values:
+    ps.add(p)
+  opaque.plist.clear()
+  for p in ps:
+    #TODO maybe finalize?
+    let val = JS_MKPTR(JS_TAG_OBJECT, p)
+    JS_SetOpaque(val, nil)
+    JS_FreeValueRT(rt, val)
   JS_FreeRuntime(rt)
   runtimes.del(runtimes.find(rt))