mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-29 14:43:38 +00:00
1. Added NULL reference check
2. Removed suspend/resume duktape call
This commit is contained in:
@@ -204,12 +204,10 @@ duk_ret_t ILibDuktape_ChildProcess_waitExit(duk_context *ctx)
|
||||
|
||||
#ifdef WIN32
|
||||
duk_thread_state ts;
|
||||
duk_suspend(ctx, &ts);
|
||||
duk_ctx_context_data(ctx)->apc_flags = 1;
|
||||
while ((result=WaitForSingleObjectEx(eptr, duk_is_number(ctx, 0) ? duk_require_int(ctx, 0) : INFINITE, TRUE)) != WAIT_OBJECT_0 && result != WAIT_TIMEOUT);
|
||||
duk_ctx_context_data(ctx)->apc_flags = 0;
|
||||
CloseHandle(eptr);
|
||||
duk_resume(ctx, &ts);
|
||||
if (result == WAIT_TIMEOUT) { return(ILibDuktape_Error(ctx, "timeout")); }
|
||||
#else
|
||||
void *mods[] = { ILibGetBaseTimer(Duktape_GetChain(ctx)), Duktape_GetPointerProperty(ctx, -1, ILibDuktape_ChildProcess_Manager) };
|
||||
|
||||
@@ -6343,6 +6343,11 @@ void ILibLifeTime_AddEx(void *LifetimeMonitorObject,void *data, int ms, ILibLife
|
||||
struct ILibLifeTime *LifeTimeMonitor = (struct ILibLifeTime*)LifetimeMonitorObject;
|
||||
void *node;
|
||||
|
||||
if (LifetimeMonitorObject == NULL)
|
||||
{
|
||||
if (Destroy != NULL) { Destroy(data); }
|
||||
return;
|
||||
}
|
||||
if ((ltms = (struct LifeTimeMonitorData*)malloc(sizeof(struct LifeTimeMonitorData))) == NULL) ILIBCRITICALEXIT(254);
|
||||
memset(ltms,0,sizeof(struct LifeTimeMonitorData));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user