From ae5560f33a5af6280b11c5b694952d27ade1e226 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 12 Jul 2022 02:12:03 +0000 Subject: [PATCH] Is this a thing? Ref a value while we call it? git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3931 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/taskstub.js.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/taskstub.js.c b/src/taskstub.js.c index 3c7f7cd7..0844dfbd 100644 --- a/src/taskstub.js.c +++ b/src/taskstub.js.c @@ -291,12 +291,14 @@ static void _taskstub_on_process_exit(uv_process_t* process, int64_t status, int JSContext* context = tf_task_get_context(stub->_owner); if (!JS_IsUndefined(stub->_on_exit)) { + JSValue ref = JS_DupValue(context, stub->_on_exit); JSValue argv[] = { JS_NewInt32(context, status), JS_NewInt32(context, terminationSignal) }; JSValue result = JS_Call(context, stub->_on_exit, JS_NULL, 2, argv); tf_util_report_error(context, result); JS_FreeValue(context, result); JS_FreeValue(context, argv[0]); JS_FreeValue(context, argv[1]); + JS_FreeValue(context, ref); } if (stub->_stream) {