Fix race between network client disconnect and network window deletion

This commit is contained in:
Jonathan G Rennison
2022-06-22 19:23:20 +01:00
parent ccef4baea6
commit ff064e06b8
7 changed files with 25 additions and 7 deletions

View File

@@ -15,6 +15,7 @@
#include "../network_internal.h"
#include "../../debug.h"
#include "../../error.h"
#include "../../window_func.h"
#include "table/strings.h"
@@ -109,6 +110,7 @@ NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool error)
if (!_network_server && _networking) {
extern void ClientNetworkEmergencySave(); // from network_client.cpp
ClientNetworkEmergencySave();
DeleteNetworkClientWindows();
_switch_mode = SM_MENU;
_networking = false;
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL);