diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 4d980a0..cbae55c 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1408,26 +1408,26 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource ) thr { // search the external dispatcher causing this call in our map Reference< XDispatch > xSource(_rSource.Source, UNO_QUERY); + ExternalFeaturesMap::iterator aLoopEnd = m_aExternalFeatures.end(); if(xSource.is()) { for ( ExternalFeaturesMap::iterator aLoop = m_aExternalFeatures.begin(); - aLoop != m_aExternalFeatures.end(); + aLoop != aLoopEnd; ++aLoop ) { if ( aLoop->second.xDispatcher.get() == xSource.get() ) { - ExternalFeaturesMap::iterator aPrevious = aLoop; - --aPrevious; - - // remove it - m_aExternalFeatures.erase( aLoop ); - // maybe update the UI implCheckExternalSlot(aLoop->first); - // continue, the same XDispatch may be resposible for more than one URL - aLoop = aPrevious; + // remove it + aLoop = m_aExternalFeatures.erase( aLoop ); + + if (aLoop == aLoopEnd) + break; + + // continue, the same XDispatch may be responsible for more than one URL } } }