sw/source/core/inc/rolbck.hxx | 13 ++++--------- sw/source/core/undo/rolbck.cxx | 10 +++------- 2 files changed, 7 insertions(+), 16 deletions(-)
New commits: commit 5028475adb6fa164c18b93ab7fb83b2256d78a89 Author: Shreyansh Gandhi <gandhish...@gmail.com> Date: Tue Jun 10 22:08:39 2014 +0530 fdo#75757: Remove inheritance from std::vector Problem: Many classes inherit directly from std::vector See comment#6 by kendy for more details. Solution: Removed class SwpHstry altogether and moved its destructor's functionality to SwHistory's destructor. Changed type of m_SwpHstry from SwpHstry to vector<SwHistoryHint*> Change-Id: I32a7e111fef7c5e7b83ecee6469e173b5a21a5bf Reviewed-on: https://gerrit.libreoffice.org/9725 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx index 0c36352..8db7247 100644 --- a/sw/source/core/inc/rolbck.hxx +++ b/sw/source/core/inc/rolbck.hxx @@ -337,21 +337,16 @@ public: }; -class SwpHstry : public std::vector<SwHistoryHint*> { -public: - // the destructor will free all objects still in the vector - ~SwpHstry(); -}; - class SwHistory { friend class SwDoc; // actually only SwDoc::DelUndoObj may access friend class SwRegHistory; // for inserting History attributes - SwpHstry m_SwpHstry; + std::vector<SwHistoryHint*> m_SwpHstry; sal_uInt16 m_nEndDiff; public: + typedef std::vector<SwHistoryHint*>::iterator SwpHstry_iterator; SwHistory( sal_uInt16 nInitSz = 0 ); ~SwHistory(); @@ -383,8 +378,8 @@ public: void Move( sal_uInt16 nPos, SwHistory *pIns, sal_uInt16 const nStart = 0) { - SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart; - SwpHstry::iterator itSourceEnd = pIns->m_SwpHstry.end(); + SwpHstry_iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart; + SwpHstry_iterator itSourceEnd = pIns->m_SwpHstry.end(); if (itSourceBegin == itSourceEnd) return; m_SwpHstry.insert(m_SwpHstry.begin() + nPos, itSourceBegin, itSourceEnd); pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd ); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 20fa77b..cafee25 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -976,6 +976,9 @@ SwHistory::SwHistory( sal_uInt16 nInitSz ) SwHistory::~SwHistory() { + std::vector<SwHistoryHint*>::const_iterator it; + for(it = m_SwpHstry.begin(); it != m_SwpHstry.end(); ++it) + delete *it; Delete( 0 ); } @@ -1429,11 +1432,4 @@ void SwRegHistory::_MakeSetWhichIds() } } } - -SwpHstry::~SwpHstry() -{ - for(const_iterator it = begin(); it != end(); ++it) - delete *it; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits