[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/solid/solid/backends/hal
From:       David Faure <faure () kde ! org>
Date:       2008-07-23 17:11:26
Message-ID: 200807231911.27041.faure () kde ! org
[Download RAW message or body]

On Wednesday 23 July 2008, Albert Astals Cid wrote:
> A Dimecres 23 Juliol 2008, Kevin Ottens va escriure:
> > SVN commit 837036 by ervin:
> >
> > Potentially invalid iterator on erase() call. Never experienced it so
> > far, which is odd, but better safe than sorry.รง
> 
> That --it seems that would fail if the removed item is the first of the 
> collection, no?

Yep, in theory (in practice I don't know of implementations which do bounds checking in --it...)
Normally this loop is written with while() and } else { ++it } at the end.

Or using QMutableListIterator<QString> (java-style), the loop is much simpler to write.

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic