From 88d41d7db8f881dcc27e687ae5ba90138a9062da Mon Sep 17 00:00:00 2001 From: CPunch Date: Wed, 3 Feb 2021 13:03:24 -0600 Subject: [PATCH] Fixed minor GC freeze bug in pcall() --- src/cbaselib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cbaselib.c b/src/cbaselib.c index 95ba39d..cf60cb9 100644 --- a/src/cbaselib.c +++ b/src/cbaselib.c @@ -53,11 +53,17 @@ int cosmoB_pcall(CState *state, int nargs, CValue *args) { return 0; } + // unfreeze the state GC before calling the function + cosmoM_unfreezeGC(state); + // call the passed callable COSMOVMRESULT res = cosmoV_pcall(state, nargs-1, 1); // insert false before the result cosmo_insert(state, 0, cosmoV_newBoolean(res == COSMOVM_OK)); + + // refreeze the state GC so it can be properly unfrozen + cosmoM_freezeGC(state); return 2; }