From 31e7845339b30a69f06a04619660398fe4267268 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 17 Feb 2022 12:19:49 +0200 Subject: use more SfxItemSet::CloneAsValue to reduce heap allocations Change-Id: Ia755c3e7f9610a5441a447cc74ea38ebcef068bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130066 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/sdr/properties/e3dsceneproperties.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index 93d4e2eed9f8..a0887cc15aee 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -115,15 +115,14 @@ namespace sdr::properties { // Generate filtered ItemSet which contains all but the SDRATTR_3DSCENE items. // #i50808# Leak fix, Clone produces a new instance and we get ownership here - std::unique_ptr pNewSet(rSet.Clone()); - DBG_ASSERT(pNewSet, "E3dSceneProperties::SetMergedItemSet(): Could not clone ItemSet (!)"); + SfxItemSet aNewSet(rSet.CloneAsValue()); for(sal_uInt16 b(SDRATTR_3DSCENE_FIRST); b <= SDRATTR_3DSCENE_LAST; b++) { - pNewSet->ClearItem(b); + aNewSet.ClearItem(b); } - if(pNewSet->Count()) + if(aNewSet.Count()) { for(size_t a = 0; a < nCount; ++a) { @@ -132,7 +131,7 @@ namespace sdr::properties if(dynamic_cast(pObj)) { // set merged ItemSet at contained 3d object. - pObj->SetMergedItemSet(*pNewSet, bClearAllItems); + pObj->SetMergedItemSet(aNewSet, bClearAllItems); } } } -- cgit