Have we achieved clean shutdown?

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4841 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-02-13 23:07:36 +00:00
parent e7791d38ff
commit 685754895b
6 changed files with 84 additions and 75 deletions

View File

@ -205,7 +205,7 @@ static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int a
JS_FreeValue(context, taskObject);
}
}
return result;
return JS_DupValue(context, result);
}
static void _taskstub_gc_mark(JSRuntime* rt, JSValueConst value, JS_MarkFunc mark_func)
@ -326,8 +326,8 @@ static void _taskstub_finalizer(JSRuntime* runtime, JSValue value)
static void _taskstub_on_handle_close(uv_handle_t* handle)
{
tf_taskstub_t* stub = handle->data;
handle->data = NULL;
tf_task_remove_child(stub->_owner, stub);
handle->data = NULL;
_taskstub_cleanup(stub);
}
@ -455,9 +455,8 @@ static JSValue _taskstub_execute(JSContext* context, JSValueConst this_val, int
return result;
}
static JSValue _taskstub_kill(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
JSValue tf_taskstub_kill(tf_taskstub_t* stub)
{
tf_taskstub_t* stub = JS_GetOpaque(this_val, _classId);
JSValue result = JS_UNDEFINED;
if (!tf_task_get_one_proc(stub->_owner))
{
@ -472,35 +471,10 @@ static JSValue _taskstub_kill(JSContext* context, JSValueConst this_val, int arg
return result;
}
void tf_taskstub_destroy(tf_taskstub_t* stub)
static JSValue _taskstub_kill(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
{
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(context, object);
}
tf_taskstub_t* stub = JS_GetOpaque(this_val, _classId);
return tf_taskstub_kill(stub);
}
void tf_taskstub_on_error(tf_taskstub_t* stub, JSValue error)