diff options
author | bptato <nincsnevem662@gmail.com> | 2022-09-14 19:33:27 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-09-14 19:33:27 +0200 |
commit | cea4aa0374a2f8c1df40a30060c34de8ce257090 (patch) | |
tree | 3958c7d17de112fdad163d20a4f58a7fe9da8533 /src/js/javascript.nim | |
parent | 51d83224320b8bd4e81332802bb62158ae6deec5 (diff) | |
download | chawan-cea4aa0374a2f8c1df40a30060c34de8ce257090.tar.gz |
Tweaks/bugfixes for arm
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r-- | src/js/javascript.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index 9ba4e87f..0bb7b12f 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -1,6 +1,5 @@ import macros import options -import sequtils import strformat import strutils import tables @@ -272,7 +271,10 @@ func newJSClass*(ctx: JSContext, cdef: JSClassDefConst, cctor: JSCFunction, func else: proto = JS_NewObject(ctx) if funcs.len > 0: - rtOpaque.flist.add(funcs.toSeq()) + # We avoid funcs being GC'ed by putting the list in rtOpaque. + # (QuickJS uses the pointer later.) + #TODO maybe put them in ctxOpaque instead? + rtOpaque.flist.add(@funcs) JS_SetPropertyFunctionList(ctx, proto, addr rtOpaque.flist[^1][0], cint(funcs.len)) assert JS_SetProperty(ctx, proto, ctxOpaque.sym_toStringTag, JS_NewString(ctx, cdef.class_name)) == 1 JS_SetClassProto(ctx, result, proto) |