mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-30 00:45:26 -05:00
Fix Moonraker connection threads outliving a destroyed printer agent connect_printer and disconnect_printer detached the in-flight connection thread, so the agent's destructor could not join it. On exit, clear_printer_agent_cache disconnects each agent and then destroys it, and a connection thread whose query succeeded afterwards used the freed agent. Each connection thread now joins the one it replaces, so the destructor's join waits for all of them. The server info and status queries are cancelled once their connection is superseded, so the wait is about a second at most. A superseded connection no longer writes its status into the next connection's cache or reports itself connected. clear_printer_agent_cache destroys the agents after releasing the registry lock, since destroying one now waits for its threads. Co-authored-by: Ian Chua <iancrb00@gmail.com>
OrcaSlicer tests
Building, running and writing tests is documented on the wiki, under How to Test.
Two files here rather than there, because coding agents only read what is in the repository: