ClientList.cxx: copy client list before iterating
It seems that it is not safe to remove the item from std::list while it's being iterated somewhere else. This is a very simple quick fix to make things work until some better solution is implemented.
This commit is contained in:
parent
90ab65f8c7
commit
f53dadcc6d
|
@ -59,7 +59,8 @@ client_list_add(Client *client)
|
||||||
void
|
void
|
||||||
client_list_foreach(void (*callback)(Client *client, void *ctx), void *ctx)
|
client_list_foreach(void (*callback)(Client *client, void *ctx), void *ctx)
|
||||||
{
|
{
|
||||||
for (Client *client : clients)
|
auto clients_local = std::list<Client *>(clients);
|
||||||
|
for (Client *client : clients_local)
|
||||||
callback(client, ctx);
|
callback(client, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue