[Libreoffice-commits] core.git: dbaccess/source

Michael Meeks michael.meeks at collabora.com
Thu Jul 2 02:24:30 PDT 2015


 dbaccess/source/ui/querydesign/JoinTableView.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 356bc0f697299e5fb6156ce25dc69845eaa6f9e6
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Jul 1 19:03:55 2015 +0100

    tdf#92434 - fix iteration, and remember to disposeAndClear.
    
    Change-Id: Id9c7b33689ea51a18394a96acbb9c08d67992942
    Reviewed-on: https://gerrit.libreoffice.org/16671
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 32adfa6..1586cd9 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -246,7 +246,7 @@ sal_uLong OJoinTableView::GetTabWinCount()
     return m_aTableMap.size();
 }
 
-bool OJoinTableView::RemoveConnection( OTableConnection* _pConn,bool _bDelete )
+bool OJoinTableView::RemoveConnection( OTableConnection* _pConn, bool _bDelete )
 {
     DeselectConn(_pConn);
 
@@ -255,8 +255,12 @@ bool OJoinTableView::RemoveConnection( OTableConnection* _pConn,bool _bDelete )
 
     m_pView->getController().removeConnectionData( _pConn->GetData() );
 
-    m_vTableConnection.erase(
-                        ::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),_pConn) );
+    auto it = ::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),_pConn);
+    if (it != m_vTableConnection.end())
+    {
+        it->disposeAndClear();
+        m_vTableConnection.erase( it );
+    }
 
     modified();
     if ( m_pAccessible )
@@ -983,10 +987,13 @@ void OJoinTableView::ClearAll()
     HideTabWins();
 
     // and the same with the Connections
-    auto aIter = m_vTableConnection.begin();
-    auto aEnd = m_vTableConnection.end();
-    for(;aIter != aEnd;++aIter)
-        RemoveConnection( *aIter ,true);
+    while(true)
+    {
+        auto aIter = m_vTableConnection.begin();
+        if (aIter == m_vTableConnection.end())
+            break;
+        RemoveConnection(*aIter, true);
+    }
     m_vTableConnection.clear();
 
     m_pLastFocusTabWin  = NULL;


More information about the Libreoffice-commits mailing list