Blob Blame History Raw
From 300578ec39bfc829afefb30d4149881297a799fa Mon Sep 17 00:00:00 2001
From: Julien Nabet <serval2412@yahoo.fr>
Date: Mon, 23 Jan 2012 21:09:24 +0100
Subject: [PATCH] Fix fdo#44040 VIEWING: Crash when page preview after <f4>
 (data sources)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Caolán fixed Iterator management which was buggy. (thank you !)

Signed-off-by: Tor Lillqvist <tlillqvist@suse.com>
---
 dbaccess/source/ui/browser/unodatbr.cxx |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 37f0880..3525fcf 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1409,24 +1409,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;
                 }
             }
         }
-- 
1.7.7.6