diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/inc/svdoutlinercache.hxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdoutlinercache.cxx | 21 |
2 files changed, 7 insertions, 19 deletions
diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx index f3aa9ec43107..30f5c6699e11 100644 --- a/svx/source/inc/svdoutlinercache.hxx +++ b/svx/source/inc/svdoutlinercache.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_SOURCE_INC_SVDOUTLINERCACHE_HXX #include <sal/types.h> +#include <memory> #include <vector> #include <set> @@ -32,8 +33,8 @@ class SdrOutlinerCache { private: SdrModel* mpModel; - std::vector< SdrOutliner* > maModeOutline; - std::vector< SdrOutliner* > maModeText; + std::vector< std::unique_ptr<SdrOutliner> > maModeOutline; + std::vector< std::unique_ptr<SdrOutliner> > maModeText; std::set< SdrOutliner* > maActiveOutliners; public: diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx index bd95f359fe1a..419837070d4f 100644 --- a/svx/source/svdraw/svdoutlinercache.cxx +++ b/svx/source/svdraw/svdoutlinercache.cxx @@ -36,12 +36,12 @@ SdrOutliner* SdrOutlinerCache::createOutliner( OutlinerMode nOutlinerMode ) if( (OutlinerMode::OutlineObject == nOutlinerMode) && !maModeOutline.empty() ) { - pOutliner = maModeOutline.back(); + pOutliner = maModeOutline.back().release(); maModeOutline.pop_back(); } else if( (OutlinerMode::TextObject == nOutlinerMode) && !maModeText.empty() ) { - pOutliner = maModeText.back(); + pOutliner = maModeText.back().release(); maModeText.pop_back(); } else @@ -57,19 +57,6 @@ SdrOutliner* SdrOutlinerCache::createOutliner( OutlinerMode nOutlinerMode ) SdrOutlinerCache::~SdrOutlinerCache() { - for( auto candA : maModeOutline ) - { - delete candA; - } - - maModeOutline.clear(); - - for( auto candB : maModeText ) - { - delete candB; - } - - maModeText.clear(); } void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner ) @@ -80,7 +67,7 @@ void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner ) if( OutlinerMode::OutlineObject == nOutlMode ) { - maModeOutline.push_back(pOutliner); + maModeOutline.emplace_back(pOutliner); pOutliner->Clear(); pOutliner->SetVertical( false ); @@ -89,7 +76,7 @@ void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner ) } else if( OutlinerMode::TextObject == nOutlMode ) { - maModeText.push_back(pOutliner); + maModeText.emplace_back(pOutliner); pOutliner->Clear(); pOutliner->SetVertical( false ); |