From 0556af3e076bfe56cddb2193efd2451dedadd162 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 30 May 2022 19:32:54 +0000 Subject: [PATCH] Socket was missing a GC mark function? git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3883 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/socket.js.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/socket.js.c b/src/socket.js.c index ad517882..f0cec254 100644 --- a/src/socket.js.c +++ b/src/socket.js.c @@ -80,12 +80,24 @@ static void _socket_processOutgoingTls(socket_t* socket); static void _socket_reportTlsErrors(socket_t* socket); static void _socket_reportError(socket_t* socket, const char* error); +static void _socket_gc_mark(JSRuntime* runtime, JSValueConst value, JS_MarkFunc mark_func) +{ + socket_t* socket = JS_GetOpaque(value, _classId); + if (socket) + { + JS_MarkValue(runtime, socket->_onConnect, mark_func); + JS_MarkValue(runtime, socket->_onRead, mark_func); + JS_MarkValue(runtime, socket->_onError, mark_func); + } +} + JSValue tf_socket_register(JSContext* context) { JS_NewClassID(&_classId); JSClassDef def = { .class_name = "Socket", .finalizer = &_socket_finalizer, + .gc_mark = _socket_gc_mark, }; if (JS_NewClass(JS_GetRuntime(context), _classId, &def) != 0) {