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

@ -598,7 +598,7 @@ static void _tf_task_sendPromiseExportMessage(tf_task_t* from, tf_taskstub_t* to
JSValue _tf_task_get_parent(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
{
tf_task_t* task = JS_GetContextOpaque(context);
return task->_parent ? tf_taskstub_get_task_object(task->_parent) : JS_UNDEFINED;
return task->_parent ? JS_DupValue(context, tf_taskstub_get_task_object(task->_parent)) : JS_UNDEFINED;
}
static JSValue _tf_task_version(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
@ -880,6 +880,7 @@ void tf_task_on_receive_packet(int packetType, const char* begin, size_t length,
JS_FreeValue(to->_context, value);
JSValue utf8 = tf_util_utf8_decode(to->_context, source);
JS_FreeValue(to->_context, source);
const char* source_str = JS_ToCString(to->_context, utf8);
JS_FreeValue(to->_context, utf8);
JSValue result = _tf_task_executeSource(to, source_str, name);
@ -1331,7 +1332,8 @@ void tf_task_activate(tf_task_t* task)
JSContext* context = task->_context;
JSValue global = JS_GetGlobalObject(context);
JS_SetPropertyStr(context, global, "exports", JS_NewObject(context));
JSValue e = JS_NewObject(context);
JS_SetPropertyStr(context, global, "exports", e);
JSAtom atom = JS_NewAtom(context, "parent");
JS_DefinePropertyGetSet(context, global, atom, JS_NewCFunction(context, _tf_task_get_parent, "parent", 0), JS_UNDEFINED, 0);