From d33187995a253890bf0cdee557319f05123b4f01 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sun, 17 Mar 2024 04:14:38 +0100 Subject: [PATCH] Unset client.conn.playing on disconnect Since it's used everywhere in the client code to determine the current player, keeping it set to a dangling value triggers various assertions. Closes #2195. --- client/clinet.cpp | 3 ++- client/gui_main.cpp | 7 ------- client/qtg_cxxside.h | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/client/clinet.cpp b/client/clinet.cpp index 2cc1815924..f5705d722d 100644 --- a/client/clinet.cpp +++ b/client/clinet.cpp @@ -55,7 +55,8 @@ static void close_socket_nomessage(struct connection *pc) { connection_common_close(pc); - remove_net_input(); + pc->playing = nullptr; + popdown_races_dialog(); set_client_state(C_S_DISCONNECTED); diff --git a/client/gui_main.cpp b/client/gui_main.cpp index 1b83fc3643..907c15b113 100644 --- a/client/gui_main.cpp +++ b/client/gui_main.cpp @@ -146,13 +146,6 @@ void sound_bell() */ void add_net_input(QIODevice *sock) { king()->add_server_source(sock); } -/** - Stop waiting for any server network data. See add_net_input(). - - This function is called if the client disconnects from the server. - */ -void remove_net_input() {} - /** Set one of the unit icons (specified by idx) in the information area based on punit. diff --git a/client/qtg_cxxside.h b/client/qtg_cxxside.h index 233a00468e..8518a731f9 100644 --- a/client/qtg_cxxside.h +++ b/client/qtg_cxxside.h @@ -20,7 +20,6 @@ class QTcpSocket; void options_extra_init(); void set_rulesets(int num_rulesets, QStringList rulesets); void add_net_input(QIODevice *sock); -void remove_net_input(); void real_conn_list_dialog_update(void *unused); void sound_bell();