Problem with FrameList and casting

Jeff Mitchell kde-dev at emailgoeshere.com
Sat Aug 9 03:23:49 CEST 2008


On Friday 08 August 2008, Scott Wheeler wrote:
> Jeff Mitchell wrote:
> > However, I get segfaults on that dynamic_cast line.  No idea why.
> >
> > This exact code used to work for me, in code from about 2 years ago.
> > Could this be a regression?  If not, what am I doing wrong?
>
> Hi Jeff --
>
> Nothing immediately jumps out at me there as being wrong.  Did you try
> valgrinding it?

Thanks to Michael Pyne and Scott Wheeler for their help.  The problem was a 
misunderstanding on my part of the erase function of a FrameList.

I had thought that "due to the nature of a list this operation can be done in 
constant time, and only invalidates iterators/references to the element being 
removed" meant that when my loop next looped through, the iterator would be 
incremented and would thus be valid again.  Turns out that you have to assign 
the iterator to the return value of the erase function.

--Jeff


More information about the taglib-devel mailing list