diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-01-13 15:36:25 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-01-13 15:36:25 +0600 |
commit | f53dadcc6d0a29ce7419a07a51762b4b44654696 (patch) | |
tree | 1991579119426b5a442acfe4d533e3569cdbedcd /src/ClientList.cxx | |
parent | 90ab65f8c732e83bd99a1621e38a4e690c71e95d (diff) | |
download | mpd-f53dadcc6d0a29ce7419a07a51762b4b44654696.tar.gz mpd-f53dadcc6d0a29ce7419a07a51762b4b44654696.tar.xz mpd-f53dadcc6d0a29ce7419a07a51762b4b44654696.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/ClientList.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ClientList.cxx b/src/ClientList.cxx index b45be34c3..403da3a18 100644 --- a/src/ClientList.cxx +++ b/src/ClientList.cxx @@ -59,7 +59,8 @@ client_list_add(Client *client) void 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); } |