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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun May 23 06:55:47 UTC 2021


 sw/source/core/inc/SwUndoFmt.hxx  |    3 ++-
 sw/source/core/undo/SwUndoFmt.cxx |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit f8ffedfd3c05b7526d934f53f7f5f0ee2dd4fb78
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat May 22 18:23:50 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun May 23 08:55:14 2021 +0200

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

diff --git a/sw/source/core/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx
index b91eec91d539..f02776339c90 100644
--- a/sw/source/core/inc/SwUndoFmt.hxx
+++ b/sw/source/core/inc/SwUndoFmt.hxx
@@ -23,6 +23,7 @@
 #include <undobj.hxx>
 #include <swundo.hxx>
 #include <numrule.hxx>
+#include <memory>
 
 class SwDoc;
 class SwTextFormatColl;
@@ -36,7 +37,7 @@ protected:
     OUString m_sDerivedFrom;
     SwDoc& m_rDoc;
     mutable OUString m_sNewName;
-    SfxItemSet * m_pNewSet;
+    std::unique_ptr<SfxItemSet> m_pNewSet;
     sal_uInt16 m_nId;     // FormatId related
     bool m_bAuto;
 
diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx
index 818cf7e751e1..110f138f5f3b 100644
--- a/sw/source/core/undo/SwUndoFmt.cxx
+++ b/sw/source/core/undo/SwUndoFmt.cxx
@@ -31,7 +31,7 @@
 SwUndoFormatCreate::SwUndoFormatCreate
 (SwUndoId nUndoId, SwFormat * _pNew, SwFormat const * _pDerivedFrom, SwDoc& rDoc)
     : SwUndo(nUndoId, &rDoc), m_pNew(_pNew),
-      m_rDoc(rDoc), m_pNewSet(nullptr), m_nId(0), m_bAuto(false)
+      m_rDoc(rDoc), m_nId(0), m_bAuto(false)
 {
     if (_pDerivedFrom)
         m_sDerivedFrom = _pDerivedFrom->GetName();
@@ -54,7 +54,7 @@ void SwUndoFormatCreate::UndoImpl(::sw::UndoRedoContext &)
 
     if (m_pNew)
     {
-        m_pNewSet = new SfxItemSet(m_pNew->GetAttrSet());
+        m_pNewSet.reset(new SfxItemSet(m_pNew->GetAttrSet()));
         m_nId = m_pNew->GetPoolFormatId() & COLL_GET_RANGE_BITS;
         m_bAuto = m_pNew->IsAuto();
 


More information about the Libreoffice-commits mailing list