Let's use the iterator return by erase method of iterator list

and avoid to retrieve list->begin and loop from the first element

Change-Id: I536b7a03c4033b02a7226d25f64764c10c28bdd0
Reviewed-on: https://gerrit.libreoffice.org/23126
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Julien Nabet
2016-03-10 22:05:57 +01:00
committed by Noel Grandin
parent e94d5233dd
commit 05ff3d112b

View File

@@ -354,12 +354,11 @@ extern "C" void SAL_CALL typelib_typedescription_revokeCallback(
// OslGuard aGuard( rInit.getMutex() ); // OslGuard aGuard( rInit.getMutex() );
CallbackEntry aEntry( pContext, pCallback ); CallbackEntry aEntry( pContext, pCallback );
CallbackSet_Impl::iterator iPos( rInit.pCallbacks->begin() ); CallbackSet_Impl::iterator iPos( rInit.pCallbacks->begin() );
while (!(iPos == rInit.pCallbacks->end())) while (iPos != rInit.pCallbacks->end())
{ {
if (*iPos == aEntry) if (*iPos == aEntry)
{ {
rInit.pCallbacks->erase( iPos ); iPos = rInit.pCallbacks->erase(iPos);
iPos = rInit.pCallbacks->begin();
} }
else else
{ {