From 73b6e72ab90934eea7118793a1b71b9b53d508c8 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Mon, 17 Dec 2018 11:08:20 +0100 Subject: Fix judge buttons not appearing & crash if MS goes down during play. The former was caused by the position dropdown simply not having code to make the judge buttons appear. Alongside that, the issue(?) where `/pos judddd` (or variations) would not put the user in the judge position, but gave them the buttons anyway. The latter was caused by a simple mistake. We deleted the Lobby (and the Courtroom) frequently, however, we never did set its (their) pointer(s) back to null -- so they pointer to trash data, and the `if (w_lobby != nullptr)` part never failed. This is also now fixed, and deletion of the Lobby or the Courtroom also brings about the nulling of their pointers. --- aoapplication.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'aoapplication.cpp') diff --git a/aoapplication.cpp b/aoapplication.cpp index cb98aef7..d7c3e662 100644 --- a/aoapplication.cpp +++ b/aoapplication.cpp @@ -57,6 +57,7 @@ void AOApplication::destruct_lobby() } delete w_lobby; + w_lobby = nullptr; lobby_constructed = false; } @@ -86,6 +87,7 @@ void AOApplication::destruct_courtroom() } delete w_courtroom; + w_courtroom = nullptr; courtroom_constructed = false; } @@ -157,7 +159,7 @@ void AOApplication::ms_connect_finished(bool connected, bool will_retry) { if (will_retry) { - if (w_lobby != nullptr) + if (lobby_constructed) w_lobby->append_error("Error connecting to master server. Will try again in " + QString::number(net_manager->ms_reconnect_delay_ms / 1000.f) + " seconds."); } -- cgit