Cppcheck: Iterator 'i' used after element has been erased in servicemanager.cxx (cppuhelper module)
julien2412
serval2412 at yahoo.fr
Fri Feb 15 14:52:08 PST 2013
Hello,
Cppcheck reported this:
cppuhelper/source/servicemanager.cxx
1578 eraseDereference error Iterator 'i' used after element has been erased.
(+ 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)
Here are the lines:
1563 Data::DynamicImplementations::iterator i(
1564 data_.dynamicImplementations.find(factoryInfo));
1565 if (i == data_.dynamicImplementations.end()) {
1566 return isDisposed();
1567 }
1568 assert(i->second.get() != 0);
1569 clear = i->second;
1570 //TODO: The below leaves data_ in an inconsistent state upon
exceptions:
1571 removeFromImplementationMap(
1572 &data_.services, i->second->info->services, i->second);
1573 removeFromImplementationMap(
1574 &data_.singletons, i->second->info->singletons,
i->second);
1575 if (!i->second->info->name.isEmpty()) {
1576 data_.namedImplementations.erase(i->second->info->name);
1577 }
1578 data_.dynamicImplementations.erase(i);
1579 if (removeListener) {
1580 comp = i->second->component;
1581 }
see
http://opengrok.libreoffice.org/xref/core/cppuhelper/source/servicemanager.cxx#1554
Any idea how this should be changed?
Julien
--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-Iterator-i-used-after-element-has-been-erased-in-servicemanager-cxx-cppuhelper-module-tp4037867.html
Sent from the Dev mailing list archive at Nabble.com.
More information about the LibreOffice
mailing list