Now all the tests run clean.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4804 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -21,7 +21,8 @@
|
||||
static JSClassID _classId;
|
||||
static char _executable[1024];
|
||||
|
||||
typedef struct _tf_taskstub_t {
|
||||
typedef struct _tf_taskstub_t
|
||||
{
|
||||
taskid_t _id;
|
||||
JSValue _object;
|
||||
|
||||
@ -255,7 +256,7 @@ tf_task_t* tf_taskstub_get_owner(const tf_taskstub_t* stub)
|
||||
|
||||
tf_taskstub_t* tf_taskstub_create_parent(tf_task_t* task, uv_file file)
|
||||
{
|
||||
JSValue parentObject = JS_NewObject(tf_task_get_context(task));
|
||||
JSValue parentObject = JS_NewObjectClass(tf_task_get_context(task), _classId);
|
||||
tf_taskstub_t* parentStub = tf_malloc(sizeof(tf_taskstub_t));
|
||||
memset(parentStub, 0, sizeof(tf_taskstub_t));
|
||||
parentStub->_stream = tf_packetstream_create();
|
||||
@ -279,7 +280,6 @@ tf_taskstub_t* tf_taskstub_create_parent(tf_task_t* task, uv_file file)
|
||||
tf_printf("uv_pipe_open failed: %s\n", uv_strerror(result));
|
||||
}
|
||||
tf_packetstream_start(parentStub->_stream);
|
||||
|
||||
return parentStub;
|
||||
}
|
||||
|
||||
@ -313,8 +313,11 @@ static void _taskstub_finalizer(JSRuntime* runtime, JSValue value)
|
||||
JS_FreeValue(context, stub->_on_print);
|
||||
stub->_on_print = JS_UNDEFINED;
|
||||
}
|
||||
tf_packetstream_destroy(stub->_stream);
|
||||
stub->_stream = NULL;
|
||||
if (stub->_stream)
|
||||
{
|
||||
tf_packetstream_destroy(stub->_stream);
|
||||
stub->_stream = NULL;
|
||||
}
|
||||
stub->_finalized = true;
|
||||
tf_task_remove_child(stub->_owner, stub);
|
||||
_taskstub_cleanup(stub);
|
||||
@ -330,7 +333,6 @@ static void _taskstub_on_handle_close(uv_handle_t* handle)
|
||||
|
||||
static void _taskstub_on_process_exit(uv_process_t* process, int64_t status, int terminationSignal)
|
||||
{
|
||||
tf_printf("_taskstub_on_process_exit %d %d\n", (int)status, terminationSignal);
|
||||
tf_taskstub_t* stub = process->data;
|
||||
JSContext* context = tf_task_get_context(stub->_owner);
|
||||
if (!JS_IsUndefined(stub->_on_exit))
|
||||
@ -346,7 +348,7 @@ static void _taskstub_on_process_exit(uv_process_t* process, int64_t status, int
|
||||
}
|
||||
if (stub->_stream)
|
||||
{
|
||||
tf_packetstream_close(stub->_stream);
|
||||
tf_packetstream_destroy(stub->_stream);
|
||||
stub->_stream = NULL;
|
||||
}
|
||||
uv_close((uv_handle_t*)process, _taskstub_on_handle_close);
|
||||
@ -472,11 +474,32 @@ static JSValue _taskstub_kill(JSContext* context, JSValueConst this_val, int arg
|
||||
|
||||
void tf_taskstub_destroy(tf_taskstub_t* stub)
|
||||
{
|
||||
JSContext* context = tf_task_get_context(stub->_owner);
|
||||
if (stub->_stream)
|
||||
{
|
||||
tf_packetstream_destroy(stub->_stream);
|
||||
stub->_stream = NULL;
|
||||
}
|
||||
if (!JS_IsUndefined(stub->_on_exit))
|
||||
{
|
||||
JS_FreeValue(context, stub->_on_exit);
|
||||
stub->_on_exit = JS_UNDEFINED;
|
||||
}
|
||||
if (!JS_IsUndefined(stub->_on_error))
|
||||
{
|
||||
JS_FreeValue(context, stub->_on_error);
|
||||
stub->_on_error = JS_UNDEFINED;
|
||||
}
|
||||
if (!JS_IsUndefined(stub->_on_print))
|
||||
{
|
||||
JS_FreeValue(context, stub->_on_print);
|
||||
stub->_on_print = JS_UNDEFINED;
|
||||
}
|
||||
if (!JS_IsUndefined(stub->_object))
|
||||
{
|
||||
JSValue object = stub->_object;
|
||||
stub->_object = JS_UNDEFINED;
|
||||
JS_FreeValue(tf_task_get_context(stub->_owner), object);
|
||||
JS_FreeValue(context, object);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user