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

List:       kde-commits
Subject:    Re: KDE/kdelibs/solid/solid/backends/hal
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2008-07-23 16:57:24
Message-ID: 200807231857.24834.aacid () kde ! org
[Download RAW message or body]

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?

Albert

>
> CCMAIL: aacid@kde.org
>
>
>  M  +3 -2      halmanager.cpp
>
>
> --- trunk/KDE/kdelibs/solid/solid/backends/hal/halmanager.cpp
> #837035:837036 @@ -121,14 +121,15 @@
>
>          if (type!=Solid::DeviceInterface::Unknown) {
>              QStringList::Iterator it = result.begin();
> -            QStringList::ConstIterator end = result.end();
> +            QStringList::Iterator end = result.end();
>
>              for (; it!=end; ++it)
>              {
>                  HalDevice device(*it);
>
>                  if (!device.queryDeviceInterface(type)) {
> -                    result.erase(it);
> +                    it = result.erase(it);
> +                    --it;
>                  }
>              }
>          }



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

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