[Libreoffice-commits] core.git: svx/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Feb 7 12:10:15 UTC 2018
svx/source/inc/svdoutlinercache.hxx | 5 +++--
svx/source/svdraw/svdoutlinercache.cxx | 21 ++++-----------------
2 files changed, 7 insertions(+), 19 deletions(-)
New commits:
commit ef83e5fba10187a0ec50dab6d381ff2d4ecdc5d2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 5 11:23:35 2018 +0200
loplugin:useuniqueptr in SdrOutlinerCache
Change-Id: Ie34f1bd9e46bf767ec2e1918c2b88cf289f4b410
Reviewed-on: https://gerrit.libreoffice.org/49330
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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 );
More information about the Libreoffice-commits
mailing list