mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
Fixed edge case bug where childprocess.waitExit() called during promise.waitExit() would cause event loop to prematurely exit.
This commit is contained in:
@@ -204,8 +204,11 @@ duk_ret_t ILibDuktape_ChildProcess_waitExit(duk_context *ctx)
|
||||
return(ILibDuktape_Error(ctx, "Cannot waitExit() because JS Engine is exiting"));
|
||||
}
|
||||
|
||||
duk_push_int(ctx, 1); // [spawnedProcess][flag]
|
||||
duk_put_prop_string(ctx, -2, "\xFF_WaitExit"); // [spawnedProcess]
|
||||
if (ILibChain_GetContinuationState(chain) != ILibChain_ContinuationState_CONTINUE)
|
||||
{
|
||||
duk_push_int(ctx, 1); // [spawnedProcess][flag]
|
||||
duk_put_prop_string(ctx, -2, "\xFF_WaitExit"); // [spawnedProcess]
|
||||
}
|
||||
|
||||
void *mods[] = { ILibGetBaseTimer(Duktape_GetChain(ctx)), Duktape_GetPointerProperty(ctx, -1, ILibDuktape_ChildProcess_Manager), ILibDuktape_Process_GetSignalListener(ctx) };
|
||||
#ifdef WIN32
|
||||
|
||||
@@ -1610,7 +1610,7 @@ void ILibDuktape_ScriptContainer_Engine_free(void *udata, void *ptr)
|
||||
{
|
||||
size_t sz = ptr == NULL ? 0 : ILibMemory_Size(ptr);
|
||||
|
||||
if (ptr != NULL)
|
||||
if (ptr != NULL && ILibMemory_CanaryOK(ptr))
|
||||
{
|
||||
ILibDuktape_ScriptContainer_TotalAllocations -= ILibMemory_Size(ptr);
|
||||
ILibMemory_SecureZero(ptr, sz);
|
||||
|
||||
Reference in New Issue
Block a user