diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-07-01 19:03:55 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-07-02 09:23:58 +0000 |
commit | 356bc0f697299e5fb6156ce25dc69845eaa6f9e6 (patch) | |
tree | f04ee51f8f89047873c5211bf621e76f8962a2da /dbaccess | |
parent | c74ac32544c2be241e5a5ce4de01dc0bd3b6cde9 (diff) |
tdf#92434 - fix iteration, and remember to disposeAndClear.
Change-Id: Id9c7b33689ea51a18394a96acbb9c08d67992942
Reviewed-on: https://gerrit.libreoffice.org/16671
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinTableView.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 32adfa6a167c..1586cd9a7688 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; |