1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-01 08:03:32 +00:00

Fixed bug, when global dispatch was done without context switching, stale pointers were not cleared

This commit is contained in:
Bryan Roe
2019-10-04 12:32:37 -07:00
parent 1774dc2e54
commit ba7ef6c942

View File

@@ -1577,6 +1577,7 @@ void* ILibDuktape_GlobalGenericCallback_Process(int numParms, ...)
// No need to context switch
duk_push_heapptr(refList[i]->emitter->ctx, refList[i]->emitter->object); // [obj]
duk_del_prop_string(refList[i]->emitter->ctx, -1, ILibDuktape_GenericMarshal_GlobalCallback_ThreadID);
duk_del_prop_string(refList[i]->emitter->ctx, -1, ILibDuktape_GenericMarshal_GlobalSet);
duk_pop(refList[i]->emitter->ctx); // ...
ILibDuktape_EventEmitter_SetupEmit(refList[i]->emitter->ctx, refList[i]->emitter->object, "GlobalCallback"); // [emit][this][GlobalCallback]
if (numParms > 0)
@@ -2043,6 +2044,7 @@ void ILibDuktape_GenericMarshal_Push(duk_context *ctx, void *chain)
duk_push_object(ctx); // [obj]
duk_push_object(ctx); // [obj][stashTable]
duk_put_prop_string(ctx, -2, ILibDuktape_GenericMarshal_StashTable);// [obj]
ILibDuktape_WriteID(ctx, "_GenericMarshal");
ILibDuktape_CreateInstanceMethod(ctx, "CreateVariable", ILibDuktape_GenericMarshal_CreateVariable, DUK_VARARGS);
ILibDuktape_CreateInstanceMethod(ctx, "CreateCallbackProxy", ILibDuktape_GenericMarshal_CreateCallbackProxy, 2);