mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix some invalid iterator uses
This fixes #96. When the last user in a partyline channel is deleted, the channel is deleted, too. This invalidates the iterator used in OnDeleteUser(). This fix is to increase the iterator before the channel can be deleted. After the above fix, znc still crashed due to another broken use of iterators. When a network is deleted, it takes all its clients with it (why aren't they just moved into the "no network"-state?"). However, deleting a CClient removes it from the network's list of clients via CClient::Disconnect(). This resulted in another invalid use of iterators. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -181,8 +181,8 @@ CIRCNetwork::~CIRCNetwork() {
|
||||
}
|
||||
|
||||
// Delete clients
|
||||
for (vector<CClient*>::const_iterator it = m_vClients.begin(); it != m_vClients.end(); ++it) {
|
||||
CZNC::Get().GetManager().DelSockByAddr(*it);
|
||||
while (!m_vClients.empty()) {
|
||||
CZNC::Get().GetManager().DelSockByAddr(m_vClients[0]);
|
||||
}
|
||||
m_vClients.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user