[Digikam-devel] Qt 4.5.3 QList::erase() issue?

Andi Clemens andi.clemens at gmx.net
Mon Oct 12 18:31:09 BST 2009


I'm talking for about 3 days in #qt channel, just because of this issue :D
And, someone just said that this is true for constBegin() / end() as well.

So I need to fix a lot of more code...

Andi

On Monday 12 October 2009 19:26:19 Gilles Caulier wrote:
> And in QT4 api doc, it not explained ?
> 
> If no, just report it to qt irc channel... It's enough...
> 
> Gilles
> 
> 2009/10/12 Andi Clemens <andi.clemens at gmx.net>:
> > OK!
> > You'll always learn new stuff.
> > QList::erase() will invalidate ALL iterators, so we can not save the end
> > iterator, like we do in the GPSSearch widget.
> > This is why it crashes, when the item that is deleted was the last in the
> > list.
> >
> > I will check this with valgrind now and make sure to fix any line in
> > digiKam that might use such constructs.
> >
> > Andi
> >
> > On Monday 12 October 2009 18:55:07 Andi Clemens wrote:
> >> On Monday 12 October 2009 18:51:53 Andi Clemens wrote:
> >> > Ok removing the delete statement doesn't work, I get an infinite loop
> >> > (I
> >>
> >> I mean un-commenting....
> >>
> >> >  guess because iter is somewhere behind the allocated QList memory now
> >> > and gets increased forever).
> >> >
> >> > Andi
> >> >
> >> > On Monday 12 October 2009 18:47:14 Andi Clemens wrote:
> >> > > Hi,
> >> > >
> >> > > using Qt 4.5.3 I get reproducible crashes for QList::erase().
> >> > > It seems that the method returns the same iterator object, although
> >> > > it shouldn't.
> >> > > Here is some test code:
> >> > > http://digikam3rdparty.free.fr/misc.tarballs/temp/crashy.tar.gz
> >> > >
> >> > > Either I'm doing something totally stupid here, or Qt is broken. If
> >> > > I omit the delete statement, I get a segfault, although I shouldn't
> >> > > get one if
> >> > >
> >> > >  ::erase() would work just fine.
> >> > >
> >> > > If I un-comment the delete statement, it seems to work, but only
> >> > > because the object the iter is pointing to is deleted and therefore
> >> > > the if clause is not reached.
> >> > >
> >> > > Can anyone confirm this?
> >> > > Even with an older Qt version?
> >> > >
> >> > > I don't want to submit a bug to Qt if I am the only one facing this
> >> > >  problem.
> >> > >
> >> > > Andi
> >> > > _______________________________________________
> >> > > Digikam-devel mailing list
> >> > > Digikam-devel at kde.org
> >> > > https://mail.kde.org/mailman/listinfo/digikam-devel
> >> >
> >> > _______________________________________________
> >> > Digikam-devel mailing list
> >> > Digikam-devel at kde.org
> >> > https://mail.kde.org/mailman/listinfo/digikam-devel
> >>
> >> _______________________________________________
> >> Digikam-devel mailing list
> >> Digikam-devel at kde.org
> >> https://mail.kde.org/mailman/listinfo/digikam-devel
> >
> > _______________________________________________
> > Digikam-devel mailing list
> > Digikam-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/digikam-devel
> 
> _______________________________________________
> Digikam-devel mailing list
> Digikam-devel at kde.org
> https://mail.kde.org/mailman/listinfo/digikam-devel
> 



More information about the Digikam-devel mailing list