Cppcheck: Iterator 'i' used after element has been erased in servicemanager.cxx (cppuhelper module)

Stephan Bergmann sbergman at redhat.com
Sun Feb 17 02:20:02 PST 2013


On 02/15/2013 11:52 PM, julien2412 wrote:
> Cppcheck reported this:
> cppuhelper/source/servicemanager.cxx
> 1578	eraseDereference	error	Iterator 'i' used after element has been erased.

Oops.  Fixed now as 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=80d81b40a1915eec599fc7004698ff113e5bb47f> 
"cppcheck: Iterator i used after element has been erased."  Thanks for 
reporting.

> (+ this but I don't know if we can do something:
> 1216	unusedScopedObject	error	Instance of 'Parser' object is destroyed
> immediately.
> 1390	unusedScopedObject	error	Instance of 'Parser' object is destroyed
> immediately)

Those are false positives---looks like cppcheck doesn't fully appreciate 
the implications of a language with side effects.  ;)  (Though it is 
arguably somewhat odd-looking code for sure.)

Stephan


More information about the LibreOffice mailing list