diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-09-24 11:54:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-24 16:24:21 +0200 |
commit | e69ca434253d3278975078600f8a77291d97b9fc (patch) | |
tree | 37bb648f47d54f24a517d86c30f1e291dbc6de5d /sc/source/ui/unoobj/cellsuno.cxx | |
parent | 632e7b9d43f820250acb190835f50fb50f76b725 (diff) |
no need to allocate this SfxItemSet on the heap
Change-Id: I4982d075f21f74b3d0db1c61a499dceb92e50c87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122575
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj/cellsuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 0d9e076269bc..bab189c43d15 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1432,10 +1432,8 @@ void ScCellRangesBase::ForgetCurrentAttrs() { pCurrentFlat.reset(); pCurrentDeep.reset(); - pCurrentDataSet.reset(); - pNoDfltCurrentDataSet.reset(); - pCurrentDataSet = nullptr; - pNoDfltCurrentDataSet = nullptr; + moCurrentDataSet.reset(); + moNoDfltCurrentDataSet.reset(); // #i62483# pMarkData can remain unchanged, is deleted only if the range changes (RefChanged) } @@ -1471,18 +1469,28 @@ const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep() SfxItemSet* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt) { - if(!pCurrentDataSet) + if(!moCurrentDataSet) { const ScPatternAttr* pPattern = GetCurrentAttrsDeep(); if ( pPattern ) { // replace Dontcare with Default, so that we always have a reflection - pCurrentDataSet.reset( new SfxItemSet( pPattern->GetItemSet() ) ); - pNoDfltCurrentDataSet.reset( new SfxItemSet( pPattern->GetItemSet() ) ); - pCurrentDataSet->ClearInvalidItems(); + moCurrentDataSet.emplace( pPattern->GetItemSet() ); + moNoDfltCurrentDataSet.emplace( pPattern->GetItemSet() ); + moCurrentDataSet->ClearInvalidItems(); } } - return bNoDflt ? pNoDfltCurrentDataSet.get() : pCurrentDataSet.get(); + if (bNoDflt) + { + if (moNoDfltCurrentDataSet) + return &*moNoDfltCurrentDataSet; + } + else + { + if (moCurrentDataSet) + return &*moCurrentDataSet; + } + return nullptr; } const ScMarkData* ScCellRangesBase::GetMarkData() |