mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-20 22:31:34 +01:00
Erasure of retired fd's in select.cpp causes an assertion in MSVC 2008 STL
I was hitting an issue with an SCL enabled STL library in connection with the way select_t::loop was erasing retired fd's. The problem as identified by the SCL assertion was that by the time the iterator given to the erase method was called it was considered invalid by the library. I am not sure this isn't just a "quirk" of the MSVC STL library as the other code looks valid to me as well.
This commit is contained in:
parent
99ddfa7d65
commit
59315ebdcb
@ -217,10 +217,13 @@ void zmq::select_t::loop ()
|
||||
|
||||
// Destroy retired event sources.
|
||||
if (retired) {
|
||||
for (fd_set_t::size_type i = 0; i < fds.size (); i ++) {
|
||||
if (fds [i].fd == retired_fd) {
|
||||
fds.erase (fds.begin () + i);
|
||||
i --;
|
||||
fd_set_t::iterator it = fds.begin();
|
||||
while (it != fds.end()) {
|
||||
if (it->fd == retired_fd) {
|
||||
it = fds.erase(it);
|
||||
}
|
||||
else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
retired = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user