summaryrefslogtreecommitdiff
path: root/sc/source/ui/undo/refundo.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-20 12:54:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-22 09:53:45 +0100
commitb7654432bfeca619b7657abc8d27193e44cf4dfc (patch)
tree0935306e00e967c1dca4efc8af57f4d67c30a508 /sc/source/ui/undo/refundo.cxx
parentf82888653c853f236ab0035bb578a7129ec72fa5 (diff)
loplugin:useuniqueptr in ScDocument
and fix bug where we were deleting a pointer to an object we did not own via pFormatExchangeList Change-Id: I488c679734c48bd21bc6be04837e037e97550647 Reviewed-on: https://gerrit.libreoffice.org/51668 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/undo/refundo.cxx')
-rw-r--r--sc/source/ui/undo/refundo.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx
index 7488465e63af..857120cc69da 100644
--- a/sc/source/ui/undo/refundo.cxx
+++ b/sc/source/ui/undo/refundo.cxx
@@ -80,7 +80,6 @@ ScRefUndoData::~ScRefUndoData()
delete pDetOpList;
delete pChartListenerCollection;
delete pAreaLinks;
- delete pUnoRefs;
}
void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc )
@@ -140,7 +139,7 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc )
pUnoRefs = const_cast<ScDocument*>(pDoc)->EndUnoRefUndo();
if ( pUnoRefs && pUnoRefs->IsEmpty() )
{
- DELETEZ( pUnoRefs );
+ pUnoRefs.reset();
}
}
}
@@ -148,9 +147,9 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc )
void ScRefUndoData::DoUndo( ScDocument* pDoc, bool bUndoRefFirst )
{
if (pDBCollection)
- pDoc->SetDBCollection( new ScDBCollection(*pDBCollection) );
+ pDoc->SetDBCollection( std::unique_ptr<ScDBCollection>(new ScDBCollection(*pDBCollection)) );
if (pRangeName)
- pDoc->SetRangeName( new ScRangeName(*pRangeName) );
+ pDoc->SetRangeName( std::unique_ptr<ScRangeName>(new ScRangeName(*pRangeName)) );
if (pPrintRanges)
pDoc->RestorePrintRanges(*pPrintRanges);
@@ -163,7 +162,7 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, bool bUndoRefFirst )
}
if (pDetOpList)
- pDoc->SetDetOpList( new ScDetOpList(*pDetOpList) );
+ pDoc->SetDetOpList( std::unique_ptr<ScDetOpList>(new ScDetOpList(*pDetOpList)) );
// bUndoRefFirst is bSetChartRangeLists
if ( pChartListenerCollection )