From 14a48530d911e9d9d0539eb4c273ce1379534607 Mon Sep 17 00:00:00 2001 From: Osmium Sorcerer Date: Tue, 24 Mar 2026 23:10:21 +0000 Subject: Constrain the lifetime of the demo server Demo server was being deleted and recreated every time the lobby was constructed, so it was always active. This rendered the "are we playing a demo" checks useless as they always assumed we did. Logs didn't work because of it, for example. Construct the demo server only when the user selects demo playback, and destroy it during the destruction of courtroom. Make log_filename based on the application path, so `logs` subdirectory is created relative to the executable rather than the working directory. --- src/aoapplication.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/aoapplication.cpp') diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index ecfd97a..f253a5a 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -65,11 +65,6 @@ void AOApplication::construct_lobby() discord->state_lobby(); } - if (demo_server) - { - demo_server->deleteLater(); - } - demo_server = new DemoServer(this); w_lobby->show(); } @@ -120,6 +115,8 @@ void AOApplication::destruct_courtroom() return; } + delete demo_server; + demo_server = nullptr; delete w_courtroom; w_courtroom = nullptr; } -- cgit