[Libreoffice-commits] core.git: sc/inc sc/source
Stephan Bergmann
sbergman at redhat.com
Mon Jun 12 15:54:16 UTC 2017
sc/inc/attarray.hxx | 7 +++++--
sc/source/core/data/attarray.cxx | 3 ++-
sc/source/core/data/document.cxx | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
New commits:
commit af2d5119c620947da59434c6367514925ec75bb2
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Jun 12 17:53:50 2017 +0200
Use unique_ptr fro ScMergePatternState::pItemSet
Change-Id: I672785b273eaa8862f43112d7f25ae495b65b0c7
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 551ec560981f..bfa224cbc791 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -23,6 +23,9 @@
#include "global.hxx"
#include "attrib.hxx"
#include <algorithm>
+#include <memory>
+
+#include <svl/itemset.hxx>
class ScDocument;
class ScEditDataArray;
@@ -61,14 +64,14 @@ struct ScLineFlags
struct ScMergePatternState
{
- SfxItemSet* pItemSet; ///< allocated in MergePatternArea, used for resulting ScPatternAttr
+ std::unique_ptr<SfxItemSet> pItemSet;
const ScPatternAttr* pOld1; ///< existing objects, temporary
const ScPatternAttr* pOld2;
bool mbValidPatternId;
sal_uInt64 mnPatternId;
- ScMergePatternState() : pItemSet(nullptr), pOld1(nullptr), pOld2(nullptr),
+ ScMergePatternState() : pOld1(nullptr), pOld2(nullptr),
mbValidPatternId(true), mnPatternId(0) {}
};
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 9f5141402043..28fd7e5681a4 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -19,6 +19,7 @@
#include "attarray.hxx"
#include "scitems.hxx"
+#include <o3tl/make_unique.hxx>
#include <svx/algitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/lineitem.hxx>
@@ -1017,7 +1018,7 @@ void ScAttrArray::MergePatternArea( SCROW nStartRow, SCROW nEndRow,
else
{
// first pattern - copied from parent
- rState.pItemSet = new SfxItemSet( *rThisSet.GetPool(), rThisSet.GetRanges() );
+ rState.pItemSet = o3tl::make_unique<SfxItemSet>( *rThisSet.GetPool(), rThisSet.GetRanges() );
rState.pItemSet->Set( rThisSet, bDeep );
rState.mnPatternId = pPattern->GetKey();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 33860d081b33..90e126d588bc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4983,7 +4983,7 @@ ScPatternAttr* ScDocument::CreateSelectionPattern( const ScMarkData& rMark, bool
OSL_ENSURE( aState.pItemSet, "SelectionPattern Null" );
if (aState.pItemSet)
{
- ScPatternAttr* pPattern = new ScPatternAttr( aState.pItemSet );
+ ScPatternAttr* pPattern = new ScPatternAttr( aState.pItemSet.release() );
if (aState.mbValidPatternId)
pPattern->SetKey(aState.mnPatternId);
More information about the Libreoffice-commits
mailing list