All the leaks.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3919 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-06-26 18:25:31 +00:00
parent 66ea0dadd0
commit ff2a0f0c3f
9 changed files with 50 additions and 24 deletions

View File

@ -25,7 +25,6 @@ static char _executable[1024];
typedef struct _tf_taskstub_t {
taskid_t _id;
JSValue _object;
JSValue _taskObject;
JSValue _on_exit;
JSValue _on_error;
@ -78,7 +77,7 @@ static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int a
stub->_on_exit = JS_UNDEFINED;
stub->_on_error = JS_UNDEFINED;
stub->_on_print = JS_UNDEFINED;
stub->_object = JS_DupValue(context, taskObject);
stub->_object = taskObject;
JSAtom atom = JS_NewAtom(context, "onExit");
JS_DefinePropertyGetSet(
@ -157,7 +156,6 @@ static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int a
{
tf_packetstream_set_on_receive(stub->_stream, tf_task_on_receive_packet, stub);
tf_packetstream_start(stub->_stream);
result = taskObject;
}
else
@ -200,7 +198,7 @@ taskid_t tf_taskstub_get_id(const tf_taskstub_t* stub)
JSValue tf_taskstub_get_task_object(const tf_taskstub_t* stub)
{
return stub->_taskObject;
return stub->_object;
}
tf_packetstream_t* tf_taskstub_get_stream(const tf_taskstub_t* stub)
@ -223,11 +221,10 @@ tf_taskstub_t* tf_taskstub_create_parent(tf_task_t* task, uv_file file)
parentStub->_on_error = JS_UNDEFINED;
parentStub->_on_print = JS_UNDEFINED;
parentStub->_taskObject = parentObject;
JS_SetOpaque(parentObject, parentStub);
parentStub->_owner = task;
parentStub->_id = k_task_parent_id;
parentStub->_object = JS_DupValue(tf_task_get_context(task), parentObject);
parentStub->_object = parentObject;
if (uv_pipe_init(tf_task_get_loop(task), tf_packetstream_get_pipe(parentStub->_stream), 1) != 0)
{
@ -300,9 +297,12 @@ static void _taskstub_on_process_exit(uv_process_t* process, int64_t status, int
JS_FreeValue(context, argv[0]);
JS_FreeValue(context, argv[1]);
}
tf_packetstream_close(stub->_stream);
if (stub->_stream)
{
tf_packetstream_close(stub->_stream);
stub->_stream = NULL;
}
uv_close((uv_handle_t*)process, _taskstub_on_handle_close);
tf_taskstub_destroy(stub);
}
static JSValue _taskstub_getExports(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)