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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue May 11 13:01:07 UTC 2021


 cui/source/dialogs/cuihyperdlg.cxx |    3 +--
 cui/source/dialogs/iconcdlg.cxx    |   10 +++++-----
 cui/source/inc/cuihyperdlg.hxx     |    2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit a9435ac284f9f0a4d374ab891833fbf737d2898b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue May 11 09:51:23 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue May 11 15:00:21 2021 +0200

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

diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 42d17b2fe720..d8e1790f5b20 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -85,7 +85,6 @@ void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
 SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent)
     : SfxModelessDialogController(pBindings, pChild, pParent, "cui/ui/hyperlinkdialog.ui", "HyperlinkDialog")
     , pSet            ( nullptr )
-    , pExampleSet     ( nullptr )
     , maCtrl          ( SID_HYPERLINK_GETLINK, *pBindings, this )
     , mbIsHTMLDoc     ( false )
     , m_xIconCtrl(m_xBuilder->weld_notebook("tabcontrol"))
@@ -101,7 +100,7 @@ SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld:
     // ItemSet
     if ( pSet )
     {
-        pExampleSet = new SfxItemSet( *pSet );
+        pExampleSet.reset(new SfxItemSet( *pSet ));
         pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
     }
 
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index e166c7475381..8eeed40dc181 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -163,7 +163,7 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
     IconChoicePage * pPage = pData->xPage.get();
 
     if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
-        pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+        pExampleSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
 
     if ( pSet )
     {
@@ -187,10 +187,10 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
             if ( !pExampleSet )
             {
                 SfxItemPool* pPool = pPage->GetItemSet().GetPool();
-                pExampleSet =
-                    new SfxItemSet( *pPool, GetInputRanges( *pPool ) );
+                pExampleSet.reset(
+                    new SfxItemSet( *pPool, GetInputRanges( *pPool ) ) );
             }
-            nRet = pPage->DeactivatePage( pExampleSet );
+            nRet = pPage->DeactivatePage( pExampleSet.get() );
         }
         else
             nRet = pPage->DeactivatePage( nullptr );
@@ -252,7 +252,7 @@ void SvxHpLinkDlg::SetInputSet( const SfxItemSet* pInSet )
 
     if ( !bSet && !pExampleSet && !pOutSet )
     {
-        pExampleSet = new SfxItemSet( *pSet );
+        pExampleSet.reset(new SfxItemSet( *pSet ));
         pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
     }
 }
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index af0124239563..490fbb26e4e3 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -71,7 +71,7 @@ private:
 
     const SfxItemSet*       pSet;
     std::unique_ptr<SfxItemSet>     pOutSet;
-    SfxItemSet*             pExampleSet;
+    std::unique_ptr<SfxItemSet>     pExampleSet;
     std::unique_ptr<sal_uInt16[]>   pRanges;
 
     SvxHlinkCtrl        maCtrl;         ///< Controller


More information about the Libreoffice-commits mailing list