mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-05 00:00:10 +00:00
Fixed minor GC freeze bug in pcall()
This commit is contained in:
parent
ff1804ca36
commit
88d41d7db8
@ -53,11 +53,17 @@ int cosmoB_pcall(CState *state, int nargs, CValue *args) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unfreeze the state GC before calling the function
|
||||||
|
cosmoM_unfreezeGC(state);
|
||||||
|
|
||||||
// call the passed callable
|
// call the passed callable
|
||||||
COSMOVMRESULT res = cosmoV_pcall(state, nargs-1, 1);
|
COSMOVMRESULT res = cosmoV_pcall(state, nargs-1, 1);
|
||||||
|
|
||||||
// insert false before the result
|
// insert false before the result
|
||||||
cosmo_insert(state, 0, cosmoV_newBoolean(res == COSMOVM_OK));
|
cosmo_insert(state, 0, cosmoV_newBoolean(res == COSMOVM_OK));
|
||||||
|
|
||||||
|
// refreeze the state GC so it can be properly unfrozen
|
||||||
|
cosmoM_freezeGC(state);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user