[Libreoffice-commits] core.git: editeng/inc editeng/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon May 10 06:43:40 UTC 2021


 editeng/inc/eerdll2.hxx            |    4 ++--
 editeng/source/editeng/editdoc.cxx |    2 +-
 editeng/source/editeng/eerdll.cxx  |    7 ++++---
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 47a9ee003ceb18ba9f26d2e0035d3faf1779ab05
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun May 9 20:35:04 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 10 08:43:01 2021 +0200

    simplify DefItems
    
    Change-Id: I90d5f3f77532f9e6dbbc0b2b87b5a52f4ac27ce6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115270
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/inc/eerdll2.hxx b/editeng/inc/eerdll2.hxx
index 1d98ddc6d75c..76653e79c403 100644
--- a/editeng/inc/eerdll2.hxx
+++ b/editeng/inc/eerdll2.hxx
@@ -43,10 +43,10 @@ class DefItems
 {
 public:
     DefItems();
-    std::vector<SfxPoolItem*>* getDefaults() { return ppDefItems; }
+    std::vector<SfxPoolItem*> & getDefaults() { return mvDefItems; }
     ~DefItems();
 private:
-    std::vector<SfxPoolItem*>* ppDefItems;
+    std::vector<SfxPoolItem*> mvDefItems;
 };
 
 class GlobalEditData
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 55415db284e6..fcf2f7811e56 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -3002,7 +3002,7 @@ EditEngineItemPool::EditEngineItemPool()
                     aItemInfos, nullptr )
 {
     m_xDefItems = EditDLL::Get().GetGlobalData()->GetDefItems();
-    SetDefaults(m_xDefItems->getDefaults());
+    SetDefaults(&m_xDefItems->getDefaults());
 }
 
 EditEngineItemPool::~EditEngineItemPool()
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 095c3d51eb05..a88415565f7e 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -80,9 +80,9 @@ EditDLL& EditDLL::Get()
 }
 
 DefItems::DefItems()
+    : mvDefItems(EDITITEMCOUNT)
 {
-    ppDefItems = new std::vector<SfxPoolItem*>(EDITITEMCOUNT);
-    std::vector<SfxPoolItem*>& rDefItems = *ppDefItems;
+    std::vector<SfxPoolItem*>& rDefItems = mvDefItems;
 
     // Paragraph attributes:
     SvxNumRule aDefaultNumRule( SvxNumRuleFlags::NONE, 0, false );
@@ -157,7 +157,8 @@ DefItems::DefItems()
 
 DefItems::~DefItems()
 {
-    SfxItemPool::ReleaseDefaults(ppDefItems, true);
+    for (auto& rItem : mvDefItems)
+        delete rItem;
 }
 
 std::shared_ptr<DefItems> GlobalEditData::GetDefItems()


More information about the Libreoffice-commits mailing list