diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-05 12:03:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-08 11:54:53 +0200 |
commit | 0317541c6b5486647bacaa5255e4babfc5ce9c23 (patch) | |
tree | 4e7aae2f40d40bebeec9183192b193b599a4b4b2 /sc/source/core/data/dpobject.cxx | |
parent | 8122551c799e6a083018e213b12b8901ae79625b (diff) |
use more std::unique_ptr in ScDPCollection
Change-Id: I7d76704ba76b0d47544456047bc699b12fa7c288
Reviewed-on: https://gerrit.libreoffice.org/61435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core/data/dpobject.cxx')
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index f2b322a4c2d8..d68495127de7 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -3706,9 +3706,7 @@ void ScDPCollection::WriteRefsTo( ScDPCollection& r ) const if (!bFound) { // none found, re-insert deleted object (see ScUndoDataPilot::Undo) - - ScDPObject* pDestObj = new ScDPObject(rSrcObj); - r.InsertNewTable(pDestObj); + r.InsertNewTable(o3tl::make_unique<ScDPObject>(rSrcObj)); } } OSL_ENSURE( maTables.size() == r.maTables.size(), "WriteRefsTo: couldn't restore all entries" ); @@ -3778,14 +3776,14 @@ void ScDPCollection::FreeTable(const ScDPObject* pDPObject) maTables.erase(std::remove_if(maTables.begin(), maTables.end(), funcRemoveCondition), maTables.end()); } -void ScDPCollection::InsertNewTable(ScDPObject* pDPObj) +void ScDPCollection::InsertNewTable(std::unique_ptr<ScDPObject> pDPObj) { const ScRange& rOutRange = pDPObj->GetOutRange(); const ScAddress& s = rOutRange.aStart; const ScAddress& e = rOutRange.aEnd; mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable); - maTables.push_back(std::unique_ptr<ScDPObject>(pDPObj)); + maTables.push_back(std::move(pDPObj)); } bool ScDPCollection::HasTable(const ScDPObject* pDPObj) const |