mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-20 23:44:08 +00:00
Disconnect before deleting the session
The session was deleted from `m_Sessions` before disconnecting. Since
e7a583adc0 that also deleted the session.
This commit is contained in:
@@ -496,14 +496,13 @@ bool CNetServerWorker::RunStep()
|
||||
|
||||
// Remove the session first, so we won't send player-update messages to it
|
||||
// when updating the FSM
|
||||
std::erase_if(m_Sessions, [&](const auto& s)
|
||||
{
|
||||
return s.get() == session;
|
||||
});
|
||||
const auto iter = std::ranges::find(m_Sessions, session,
|
||||
&std::unique_ptr<CNetServerSession>::get);
|
||||
const std::unique_ptr<CNetServerSession> _ = std::move(*iter);
|
||||
m_Sessions.erase(iter);
|
||||
|
||||
session->Update((uint)NMT_CONNECTION_LOST, NULL);
|
||||
|
||||
delete session;
|
||||
event.peer->data = NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user