https://gitlab.synchro.net/main/sbbs/-/commit/2fb010d6c3f20027e8b54d2a
Modified Files:
src/sbbs3/filterfile.hpp ftpsrvr.cpp mailsrvr.cpp main.cpp services.cpp Log Message:
Fix thread_down()-vs-cleanup() race causing heap corruption on Windows
thread_down() must be the very last operation in every server thread,
because cleanup() proceeds to destroy shared resources (active_clients, sockets, filterFile/trashCan objects) as soon as thread_count drops.
When a thread called thread_down() but continued accessing shared
resources afterward, cleanup() could destroy those resources
concurrently, corrupting the MSVC debug heap and triggering assertions
in strListFreeStrings during trashCan deletion.
Move thread_down() after all shared-resource access in:
- mailsrvr.cpp: smtp_thread, pop3_thread, sendmail_thread
- ftpsrvr.cpp: ctrl_thread (ftp_client_thread)
- services.cpp: 6 sites across js/native service threads
- main.cpp: passthru_socket_thread, events_thread
Also fix filterfile.hpp Rule of Five: delete copy/move operations
to prevent latent double-free, and remove unsafe default constructor
that left the pthread_mutex uninitialized.
Co-Authored-By: Claude Opus 4.6 <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net