1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-04 17:43:45 +00:00

Added gaurd, to abort dispatch if the HECI object was GC'ed.

This commit is contained in:
Bryan Roe
2019-10-28 11:31:16 -07:00
parent 5476ad8b5f
commit 823b688537

View File

@@ -768,6 +768,8 @@ void ILibDuktape_HECI_IoctlHandler_Dispatch(void *chain, void *user)
int i;
duk_context *ctx = data->ctx;
if (!ILibMemory_CanaryOK(data)) { return; } // Abort Dispatch, becuase the HECI object was GC'ed.
duk_push_heapptr(data->ctx, data->data); // [array]
duk_push_heapptr(data->ctx, data->heciObject); // [array][heci]
duk_get_prop_index(data->ctx, -2, 2); // [array][heci][callback]
@@ -940,7 +942,7 @@ duk_ret_t ILibDuktape_HECI_doIoctl(duk_context *ctx)
{
duk_dup(ctx, i); // [heci][stash][array][object]
duk_put_prop_index(ctx, -2, i-1); // [heci][stash][array]
}
}
duk_put_prop_string(ctx, -2, Duktape_GetStashKey(duk_get_heapptr(ctx, -1))); // [heci][stash]