[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - dbaccess/source

Michael Meeks michael.meeks at collabora.com
Thu Jul 2 09:34:17 PDT 2015


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

New commits:
commit f5721a9de60f614519be383fec2c97b2dd19b289
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>
    Reviewed-on: https://gerrit.libreoffice.org/16685
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 571067e..7beabaf 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