On 16/09/2012 12:26, Noel Grandin wrote:
On Sat, Sep 15, 2012 at 9:13 PM, Markus Mohrhard
wrote:
Hey,
Here are the lines:
178 void SwBlink::FrmDelete( const SwRootFrm* pRoot )
179 {
180 for( SwBlinkList::iterator it = aList.begin(); it !=
aList.end(); )
181 {
Hey Noel,
>>
>> It can't. Line 183 is supposed to be:
>>
>> aList.erase(it++);
>>
>
> No, it should be
>it = aList.erase(it);
>
> Once you have called erase(), the iterator becomes invalid, so it must
> be replaced by the iterator returned by erase(), which returns the
> next valid position,
On Sat, Sep 15, 2012 at 9:13 PM, Markus Mohrhard
wrote:
> Hey,
>
>
>>
>> Here are the lines:
>> 178 void SwBlink::FrmDelete( const SwRootFrm* pRoot )
>> 179 {
>> 180 for( SwBlinkList::iterator it = aList.begin(); it !=
>> aList.end(); )
>> 181 {
>> 182 if( pRoot
://nabble.documentfoundation.org/Cppcheck-Dangerous-iterator-usage-after-erase-method-tp4007715p4007724.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman
Hey,
>
> Here are the lines:
> 178 void SwBlink::FrmDelete( const SwRootFrm* pRoot )
> 179 {
> 180 for( SwBlinkList::iterator it = aList.begin(); it !=
> aList.end(); )
> 181 {
> 182 if( pRoot == (*it).GetRootFrm() )
> 183 aList.erase( it );
>
increment.
Any idea?
Julien
--
View this message in context:
http://nabble.documentfoundation.org/Cppcheck-Dangerous-iterator-usage-after-erase-method-tp4007715.html
Sent from the Dev mailing list archive at Nabble.com.
___
LibreOffice mail