diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-27 18:39:04 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-27 18:39:04 +0200 |
commit | 50eead4e8a483c06008553d803af8d1adaa0cc4f (patch) | |
tree | aca92f016ef2b84461d6bd42591e5440bec5d028 /src/js/javascript.nim | |
parent | cd1a36414028cbd3028a5f87ca9b91a314f5464c (diff) | |
download | chawan-50eead4e8a483c06008553d803af8d1adaa0cc4f.tar.gz |
Free JSRuntime, JSContext and ctors on exit
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r-- | src/js/javascript.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index e8c36e34..38754d78 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -89,7 +89,7 @@ type JSContextOpaque* = ref object creg: Table[string, JSClassID] typemap: Table[pointer, JSClassID] - ctors: Table[JSClassID, JSValue] #TODO TODO TODO free these + ctors: Table[JSClassID, JSValue] gclaz: string sym_refs: array[JSSymbolRefs, JSAtom] str_refs: array[JSStrRefs, JSAtom] @@ -196,6 +196,8 @@ proc free*(ctx: var JSContext) = JS_FreeAtom(ctx, a) for a in opaque.str_refs: JS_FreeAtom(ctx, a) + for classid, v in opaque.ctors: + JS_FreeValue(ctx, v) JS_FreeValue(ctx, opaque.Array_prototype_values) for v in opaque.err_ctors: JS_FreeValue(ctx, v) |