Author: hdu
Date: Mon Oct 7 11:44:41 2013
New Revision: 1529824
URL: http://svn.apache.org/r1529824
Log:
#i123418# prevent iterator decrement when it is at begin()
also prevent derefencing of an iterator after it has been erased
Modified:
openoffice/trunk/main/dbaccess/source/ui/browser/unodatbr.cxx
Modified: openoffice/trunk/main/dbaccess/source/ui/browser/unodatbr.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/dbaccess/source/ui/browser/unodatbr.cxx?rev=1529824&r1=1529823&r2=1529824&view=diff
==============================================================================
--- openoffice/trunk/main/dbaccess/source/ui/browser/unodatbr.cxx (original)
+++ openoffice/trunk/main/dbaccess/source/ui/browser/unodatbr.cxx Mon Oct 7
11:44:41 2013
@@ -1408,23 +1408,26 @@ void SAL_CALL SbaTableQueryBrowser::disp
{
for ( ExternalFeaturesMap::iterator aLoop =
m_aExternalFeatures.begin();
aLoop != m_aExternalFeatures.end();
- ++aLoop
)
{
- if ( aLoop->second.xDispatcher.get() ==
xSource.get() )
- {
- ExternalFeaturesMap::iterator aPrevious = aLoop;
- --aPrevious;
+ if ( aLoop->second.xDispatcher.get() !=
xSource.get() ) {
+ ++aLoop;
+ continue;
+ }
- // remove it
- m_aExternalFeatures.erase( aLoop );
+ // prepare to erase the aLoop iterator
+ const sal_uInt16 nSlotId = aLoop->first;
+ ExternalFeaturesMap::iterator aNext = aLoop;
+ ++aNext;
- // maybe update the UI
- implCheckExternalSlot(aLoop->first);
+ // remove it
+ m_aExternalFeatures.erase( aLoop );
- // continue, the same XDispatch may be
resposible for more than one URL
- aLoop = aPrevious;
- }
+ // maybe update the UI
+ implCheckExternalSlot( nSlotId );
+
+ // continue, the same XDispatch may be
resposible for more than one URL
+ aLoop = aNext;
}
}
else