[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Jul 4 06:37:32 UTC 2018
sc/inc/cellsuno.hxx | 2 +-
sc/source/ui/unoobj/cellsuno.cxx | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
New commits:
commit fa1028a0cd2b50d7077e4d3f7e3ae2ea96f19a53
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jul 3 13:02:16 2018 +0200
loplugin:useuniqueptr in ScCellsEnumeration
Change-Id: I2ab494c977e6c877064ba6561d850b62bef2b438
Reviewed-on: https://gerrit.libreoffice.org/56911
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 5b41dfbaef42..9cc132541a83 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -1082,7 +1082,7 @@ private:
ScDocShell* pDocShell;
ScRangeList aRanges;
ScAddress aPos;
- ScMarkData* pMark;
+ std::unique_ptr<ScMarkData> pMark;
bool bAtEnd;
private:
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 1255e6cd9d9d..b8465626ab9c 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -8951,7 +8951,7 @@ void ScCellsEnumeration::CheckPos_Impl()
{
if (!pMark)
{
- pMark = new ScMarkData;
+ pMark.reset( new ScMarkData );
pMark->MarkFromRangeList(aRanges, false);
pMark->MarkToMulti(); // needed for GetNextMarkedCell
}
@@ -8967,7 +8967,7 @@ ScCellsEnumeration::~ScCellsEnumeration()
if (pDocShell)
pDocShell->GetDocument().RemoveUnoObject(*this);
- delete pMark;
+ pMark.reset();
}
void ScCellsEnumeration::Advance_Impl()
@@ -8975,7 +8975,7 @@ void ScCellsEnumeration::Advance_Impl()
OSL_ENSURE(!bAtEnd,"too much Advance_Impl");
if (!pMark)
{
- pMark = new ScMarkData;
+ pMark.reset( new ScMarkData );
pMark->MarkFromRangeList( aRanges, false );
pMark->MarkToMulti(); // needed for GetNextMarkedCell
}
@@ -9000,8 +9000,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
aRanges.UpdateReference( pRefHint->GetMode(), &pDocShell->GetDocument(), pRefHint->GetRange(),
pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() );
- delete pMark; // recreate from moved area
- pMark = nullptr;
+ pMark.reset(); // recreate from moved area
if (!bAtEnd) // adjust aPos
{
More information about the Libreoffice-commits
mailing list