https://gitlab.synchro.net/main/sbbs/-/commit/dd868cf96f01d669158e480b
Modified Files:
src/sbbs3/mailsrvr.cpp
Log Message:
Mail server: keep the mailproc script's callback struct alive with its context
Fixes a crash in sbbs.dll (remove_js_socket_event) when an SMTP client
thread ends.
b43e1c8256 (2009-01-14) made js_mailproc() reuse one JS runtime, context
and global object per SMTP client thread, created on the first mailproc
and destroyed only when the thread ends, but left its js_callback_t as a
local of js_mailproc(). The "js" object and the client.socket Socket
object created in that persistent global recorded a pointer to the local,
which was gone as soon as the first js_mailproc() call returned.
Nothing followed that stale pointer after the call until 85e04a4262 (2026-09-30) made every Socket object remember its script's callback
struct at creation and consult it when closed. From then on, destroying
the context at thread end finalized client.socket, do_js_close() walked
the event list of a js_callback_t that was a dead stack frame, and the
mail server crashed with an access violation.
Move the js_callback_t to smtp_client_thread(), beside the runtime,
context and global, and pass it to js_mailproc(). It is still zeroed and
given the logger on each invocation, as before.
Co-Authored-By: Claude Fable 5.1 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net