Skip to content

Commit

Permalink
Unset client.conn.playing on disconnect
Browse files Browse the repository at this point in the history
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 longturn#2195.
  • Loading branch information
lmoureaux committed Mar 17, 2024
1 parent 339abcd commit d331879
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
3 changes: 2 additions & 1 deletion client/clinet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions client/gui_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion client/qtg_cxxside.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit d331879

Please sign in to comment.