[Libreoffice-commits] core.git: cui/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed May 26 11:18:32 UTC 2021


 cui/source/inc/cuitabline.hxx  |    3 ++-
 cui/source/tabpages/tpline.cxx |   11 +++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 62946de9671d718d4033cd2662107020e65368b3
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 26 09:58:08 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed May 26 13:17:51 2021 +0200

    fix leak in SvxLineTabDialog
    
    Change-Id: I4cbf0990fcc8db63f1160f1997d425c5681c47c6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116150
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 1368425c87ff..db74b0f65970 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include <memory>
 #include <vector>
 #include <editeng/brushitem.hxx>
 #include <sfx2/tabdlg.hxx>
@@ -97,7 +98,7 @@ private:
     Graphic             m_aAutoSymbolGraphic;
     tools::Long                m_nSymbolType;
     /// attributes for the shown symbols; only necessary if not equal to line properties
-    SfxItemSet*         m_pSymbolAttr;
+    std::unique_ptr<SfxItemSet> m_xSymbolAttr;
 
     std::vector<OUString>      m_aGrfNames;
     std::vector< std::unique_ptr<SvxBmpItemInfo> >
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index ceab29aed666..e8b382fe9876 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -85,7 +85,6 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* p
     , m_pSymbolList(nullptr)
     , m_bNewSize(false)
     , m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN) // unknown respectively unchanged
-    , m_pSymbolAttr(nullptr)
     , m_bLastWidthModified(false)
     , m_aSymbolLastSize(Size(0,0))
     , m_bSymbols(false)
@@ -840,9 +839,9 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
                     // directly clone to target SdrModel
                     pObj = pObj->CloneSdrObject(*pModel);
 
-                    if(m_pSymbolAttr)
+                    if(m_xSymbolAttr)
                     {
-                        pObj->SetMergedItemSet(*m_pSymbolAttr);
+                        pObj->SetMergedItemSet(*m_xSymbolAttr);
                     }
                     else
                     {
@@ -1480,9 +1479,9 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void)
 
             m_aGrfNames.emplace_back("");
             pPage->NbcInsertObject(pObj);
-            if(m_pSymbolAttr)
+            if(m_xSymbolAttr)
             {
-                pObj->SetMergedItemSet(*m_pSymbolAttr);
+                pObj->SetMergedItemSet(*m_xSymbolAttr);
             }
             else
             {
@@ -1692,7 +1691,7 @@ void SvxLineTabPage::PageCreated(const SfxAllItemSet& aSet)
         ShowSymbolControls(true);
         m_pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
         if (pSymbolAttrItem)
-            m_pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
+            m_xSymbolAttr.reset(new SfxItemSet(pSymbolAttrItem->GetItemSet()));
         if(pGraphicItem)
             m_aAutoSymbolGraphic = pGraphicItem->GetGraphic();
     }


More information about the Libreoffice-commits mailing list