On Sat, 2012-01-14 at 11:17 -0800, julien2412 wrote:
Hello,
I propose the attached patch for fdo#44040 (see
https://bugs.freedesktop.org/attachment.cgi?id=55580)
Since I could have missed something, I would like your opinion about this.
Does this work ? I worry (maybe I'm out of date on this one?) that
std::map::erase only returns an iterator in C++11x not C++98 which we
still support.
Assuming this works it avoids the two problems I see of
a) trying to move aPrevious to before the first valid iterator if aLoop
points to the first entry
b) deferencing aLoop after its been deleted in aLoop->first
which retaining the apparent rest of the logic
C.
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 4d980a0..4a80a9e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1410,24 +1410,22 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const EventObject& _rSource
) thr
Reference< XDispatch > xSource(_rSource.Source, UNO_QUERY);
if(xSource.is())
{
- for ( ExternalFeaturesMap::iterator aLoop = m_aExternalFeatures.begin();
- aLoop != m_aExternalFeatures.end();
- ++aLoop
- )
+ ExternalFeaturesMap::iterator aLoop = m_aExternalFeatures.begin();
+ ExternalFeaturesMap::iterator aEnd = m_aExternalFeatures.end();
+ while (aLoop != aEnd);
{
- if ( aLoop->second.xDispatcher.get() == xSource.get() )
+ ExternalFeaturesMap::iterator aI = aLoop++;
+ if ( aI->second.xDispatcher.get() == xSource.get() )
{
- ExternalFeaturesMap::iterator aPrevious = aLoop;
- --aPrevious;
+ sal_uInt16 nSlot = aI->first;
// remove it
- m_aExternalFeatures.erase( aLoop );
+ m_aExternalFeatures.erase(aI);
// maybe update the UI
- implCheckExternalSlot(aLoop->first);
+ implCheckExternalSlot(nSlot);
// continue, the same XDispatch may be resposible for more than one URL
- aLoop = aPrevious;
}
}
}
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.