wesnothd: avoid trying to remove destructed players from games during stack unwinding

This commit is contained in:
loonycyborg 2021-10-26 01:50:03 +03:00
parent a6923bfef0
commit fb2d03fdba
2 changed files with 8 additions and 0 deletions

View file

@ -588,6 +588,12 @@ public:
*/
bool is_reload() const;
void emergency_cleanup()
{
players_.clear();
observers_.clear();
}
private:
// forbidden operations
game(const game&) = delete;

View file

@ -1387,6 +1387,8 @@ void server::cleanup_game(game* game_ptr)
LOG_SERVER << "Could not find game (" << game_ptr->id() << ", " << game_ptr->db_id() << ") to delete in games_and_users_list_.\n";
}
if(destructed) game_ptr->emergency_cleanup();
delete game_ptr;
}