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/display/client.nim | |
parent | cd1a36414028cbd3028a5f87ca9b91a314f5464c (diff) | |
download | chawan-50eead4e8a483c06008553d803af8d1adaa0cc4f.tar.gz |
Free JSRuntime, JSContext and ctors on exit
Diffstat (limited to 'src/display/client.nim')
-rw-r--r-- | src/display/client.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/display/client.nim b/src/display/client.nim index 49dae2ea..869435ce 100644 --- a/src/display/client.nim +++ b/src/display/client.nim @@ -59,7 +59,7 @@ type pager {.jsget.}: Pager line {.jsget.}: LineEdit config {.jsget.}: Config - store {.jsget, jsset.}: URL + store {.jsget, jsset.}: Document jsrt: JSRuntime jsctx: JSContext fdmap: Table[int, Container] @@ -150,6 +150,13 @@ proc quit(client: Client, code = 0) {.jsfunc.} = if client.alive: client.alive = false client.pager.quit() + let ctx = client.jsctx + var global = JS_GetGlobalObject(ctx) + JS_FreeValue(ctx, global) + if client.jsctx != nil: + free(client.jsctx) + if client.jsrt != nil: + free(client.jsrt) quit(code) proc feedNext(client: Client) {.jsfunc.} = |