[zeromq-dev] Incompatible iterator types in xrep.cpp
Tore Halvorsen
tore.halvorsen at gmail.com
Wed May 4 11:49:28 CEST 2011
(Using latest 3.0 source : xrep.cpp - lines 98-112)
void zmq::xrep_t::terminated (reader_t *pipe_)
{
for (inpipes_t::iterator it = inpipes.begin (); it != inpipes.end ();
++it) {
if (it->reader == pipe_) {
inpipes.erase (it);
if ((inpipes_t::size_type) (it - inpipes.begin ()) < current_in)
current_in--;
if (terminating)
unregister_term_ack ();
return;
}
}
zmq_assert (false);
}
I think that comparing an erased iterator isn't strictly valid.
Erase should probably be done after decreasing current_in.
To be honest, I'm not quite sure what this function does, but
accessing iterators after erase is usually not a good idea.
--
Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul]
<demo> 2011 Tore Halvorsen || +052 0553034554
More information about the zeromq-dev
mailing list