Socket was missing a GC mark function?

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3883 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-05-30 19:32:54 +00:00
parent 2882af1c05
commit 0556af3e07

View File

@ -80,12 +80,24 @@ static void _socket_processOutgoingTls(socket_t* socket);
static void _socket_reportTlsErrors(socket_t* socket); static void _socket_reportTlsErrors(socket_t* socket);
static void _socket_reportError(socket_t* socket, const char* error); 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) JSValue tf_socket_register(JSContext* context)
{ {
JS_NewClassID(&_classId); JS_NewClassID(&_classId);
JSClassDef def = { JSClassDef def = {
.class_name = "Socket", .class_name = "Socket",
.finalizer = &_socket_finalizer, .finalizer = &_socket_finalizer,
.gc_mark = _socket_gc_mark,
}; };
if (JS_NewClass(JS_GetRuntime(context), _classId, &def) != 0) if (JS_NewClass(JS_GetRuntime(context), _classId, &def) != 0)
{ {