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:
Denis Krjuchkov 2013-01-13 15:36:25 +06:00
parent 90ab65f8c7
commit f53dadcc6d
1 changed files with 2 additions and 1 deletions

View File

@ -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);
} }