mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-18 10:27:45 +02:00
The log manager had a single external-callback slot, but the WebSocket debugger registers one per *connection* - LogBroadcaster is a local in the per-connection handler. So with two clients attached (the bundled JS debugger in a browser and Tools/wsdbg, say) the second one to connect silently took the log stream away from the first, and then whichever disconnected first cleared the slot and stopped delivery to the other as well. A one-shot wsdbg command is enough to do it: connect, take the stream, exit, and the long-lived listener that was watching the log goes quiet with nothing to say why. Make it a list with add/remove by handle. The dispatch loop holds the lock across the callbacks so a listener can't be freed while one is running - which is what lets LogBroadcaster delete its listener straight after removing it. Enabling and disabling LogOutput::ExternalCallback belongs to the list now, and disabling only happens when the last callback goes away. libretro registers one of these too, and never removes it; it just moves to the new call. It can't actually collide with the debugger - the libretro build doesn't compile Core/Debugger/WebSocket at all - but there's no reason for it to keep using an API that only has room for one caller. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>