Force a GC to ensure old compartment goes away

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2019-05-05 18:51:41 +01:00
parent ac512958ff
commit 3ba50e8574

View File

@ -611,7 +611,11 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
NSLOG(dukky, DEBUG,
"New javascript/duktape compartment, win_priv=%p, doc_priv=%p", win_priv,
doc_priv);
duk_set_top(ctx->ctx, 0);
if (CTX != NULL) {
duk_set_top(ctx->ctx, 0);
duk_gc(ctx->ctx, 0);
duk_gc(ctx->ctx, DUK_GC_COMPACT);
}
duk_push_thread(ctx->ctx);
ctx->thread = duk_require_context(ctx->ctx, -1);
duk_push_int(CTX, 0);