mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-17 16:53:13 +00:00
Updated to clear strong reference after an immediate triggers.
This commit is contained in:
@@ -602,9 +602,14 @@ duk_ret_t ILibDuktape_readableStream_resume(duk_context *ctx)
|
||||
void ILibDuktape_ReadableStream_pipe_ResumeLater(duk_context *ctx, void **args, int argsLen)
|
||||
{
|
||||
ILibDuktape_readableStream *rs = (ILibDuktape_readableStream*)args[0];
|
||||
|
||||
rs->resumeImmediate = NULL;
|
||||
if (ILibDuktape_readableStream_resume_flush(rs) == 0 && rs->ResumeHandler != NULL) { rs->paused = 0; rs->ResumeHandler(rs, rs->user); }
|
||||
if (rs->PipeHookHandler != NULL) { rs->PipeHookHandler(rs, args[1], rs->user); }
|
||||
|
||||
duk_push_this(ctx); // [immediate]
|
||||
duk_del_prop_string(ctx, -1, "self");
|
||||
duk_pop(ctx); // ...
|
||||
}
|
||||
void ILibDuktape_readableStream_pipe_later(duk_context *ctx, void **args, int argsLen)
|
||||
{
|
||||
@@ -761,6 +766,12 @@ void ILibDuktape_readableStream_unpipe_later(duk_context *ctx, void ** args, int
|
||||
if (argsLen > 1 && args[1] != NULL) { duk_push_heapptr(ctx, args[1]); duk_put_prop_string(ctx, -2, "\xFF_w"); }
|
||||
duk_pop(ctx); // ...
|
||||
ILibSpinLock_UnLock(&(data->pipeLock));
|
||||
|
||||
// Delete reference, before returning
|
||||
duk_push_this(ctx);
|
||||
duk_del_prop_string(ctx, -1, "\xFF_Self");
|
||||
duk_pop(ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -847,6 +858,11 @@ void ILibDuktape_readableStream_unpipe_later(duk_context *ctx, void ** args, int
|
||||
}
|
||||
data->unpipeInProgress = 0;
|
||||
ILibSpinLock_UnLock(&(data->pipeLock));
|
||||
|
||||
// Delete Reference before returning
|
||||
duk_push_this(ctx);
|
||||
duk_del_prop_string(ctx, -1, "\xFF_Self");
|
||||
duk_pop(ctx);
|
||||
}
|
||||
duk_ret_t ILibDuktape_readableStream_unpipe(duk_context *ctx)
|
||||
{
|
||||
|
||||
@@ -310,9 +310,12 @@ duk_ret_t ILibDuktape_WritableStream_PipeSink(duk_context *ctx)
|
||||
}
|
||||
ws->pipedReadable = duk_get_heapptr(ctx, 0);
|
||||
|
||||
if (g_displayStreamPipeMessages)
|
||||
{
|
||||
duk_dup(ctx, 0);
|
||||
duk_push_this(ctx);
|
||||
if (g_displayStreamPipeMessages) { printf("PIPE: [%s/%p] => [%s:%d]\n", Duktape_GetStringPropertyValue(ctx, -2, ILibDuktape_OBJID, "unknown"), (void*)ws, Duktape_GetStringPropertyValue(ctx, -1, ILibDuktape_OBJID, "unknown"), ILibDuktape_GetReferenceCount(ctx, -1)); }
|
||||
printf("PIPE: [%s/%p] => [%s:%d]\n", Duktape_GetStringPropertyValue(ctx, -2, ILibDuktape_OBJID, "unknown"), (void*)ws, Duktape_GetStringPropertyValue(ctx, -1, ILibDuktape_OBJID, "unknown"), ILibDuktape_GetReferenceCount(ctx, -1));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
duk_ret_t ILibDuktape_WritableStream_Ended(duk_context *ctx)
|
||||
|
||||
@@ -333,6 +333,7 @@ void ILibDuktape_net_Socket_ipc_dataHookCallbackCont(duk_context *ctx, void ** a
|
||||
{
|
||||
ILibDuktape_EventEmitter *emitter = (ILibDuktape_EventEmitter*)args[0];
|
||||
|
||||
if (!ILibMemory_CanaryOK(emitter)) { return; }
|
||||
duk_push_heapptr(emitter->ctx, emitter->object); // [stream]
|
||||
duk_get_prop_string(emitter->ctx, -1, "resume"); // [stream][resume]
|
||||
duk_dup(emitter->ctx, -2); // [stream][resume][this]
|
||||
|
||||
Reference in New Issue
Block a user