On Sunday 28 January 2007 21:49, Melchior FRANZ wrote:
> * Frederic Bouvier -- Sunday 28 January 2007:
> > > !         for(it = _listener.end(); it != _listener.end();) {
> >
> > The previous code was doing pre decrementation that I don't see here.
>
> No. The current code is wrong, just like the previous one.
> I should have written  for(it = _listener.end(); --it != _listener.end();)
> though, and not compare against a pre-calculated end, after that
> one does, of course, change.

Just a quick note, I did not try to think about that in detail, but I get the 
impression that this totally overcomplicated code is still wrong.
If you postincrement-assign and then hand that assigned iterator 
preincremented to the erase, the iterator to erase points to the same 
location than it and this leads to an access to an already deleted region ...

It should just delete those map entries that are _dead ??
If so, restore what I checked in an replace the end() initialization with the 
usual begin() one in the for statement ...
Because of the postincrement notation in the erease argument this code was 
legal ...

   Greetings

          Mathias

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to