Accessing an iterator after it is accessed is not valid.

Moving the erase after the access and check agains current_id.
This commit is contained in:
Tore Halvorsen 2011-05-04 12:41:10 +02:00 committed by Martin Sustrik
parent ceb5e1a073
commit 10120214ac

View File

@ -100,9 +100,9 @@ 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--;
inpipes.erase (it);
if (terminating)
unregister_term_ack ();
return;