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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed May 26 14:09:09 UTC 2021


 sw/source/ui/table/instable.cxx   |   18 ++++++++----------
 sw/source/uibase/inc/instable.hxx |    2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit ea4b99c294aa4ad975a8374f317b09f743aa173e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 26 10:53:39 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed May 26 16:08:22 2021 +0200

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

diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index 4990f7c08112..554e4f2611ee 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -43,9 +43,9 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC
         rInsTableOpts.mnRowsToRepeat = 0;
     if (!m_xDontSplitCB->get_active())
         nInsMode |= SwInsertTableFlags::SplitLayout;
-    if( pTAutoFormat )
+    if( m_xTAutoFormat )
     {
-        prTAFormat.reset(new SwTableAutoFormat( *pTAutoFormat ));
+        prTAFormat.reset(new SwTableAutoFormat( *m_xTAutoFormat ));
         rAutoName = prTAFormat->GetName();
     }
 
@@ -62,7 +62,6 @@ SwInsTableDlg::SwInsTableDlg(SwView& rView)
     : SfxDialogController(rView.GetFrameWeld(), "modules/swriter/ui/inserttable.ui", "InsertTableDialog")
     , m_aTextFilter(" .<>")
     , pShell(&rView.GetWrtShell())
-    , pTAutoFormat(nullptr)
     , nEnteredValRepeatHeaderNF(-1)
     , m_xNameEdit(m_xBuilder->weld_entry("nameedit"))
     , m_xWarning(m_xBuilder->weld_label("lbwarning"))
@@ -142,7 +141,7 @@ void SwInsTableDlg::InitAutoTableFormat()
     {
         SwTableAutoFormat const& rFormat = (*m_xTableTable)[ i ];
         m_xLbFormat->append_text(rFormat.GetName());
-        if (pTAutoFormat && rFormat.GetName() == pTAutoFormat->GetName())
+        if (m_xTAutoFormat && rFormat.GetName() == m_xTAutoFormat->GetName())
             lbIndex = i;
     }
 
@@ -204,16 +203,15 @@ IMPL_LINK_NOARG(SwInsTableDlg, OKHdl, weld::Button&, void)
 
     if( tbIndex < 255 )
     {
-        if( pTAutoFormat )
-            *pTAutoFormat = (*m_xTableTable)[ tbIndex ];
+        if( m_xTAutoFormat )
+            *m_xTAutoFormat = (*m_xTableTable)[ tbIndex ];
         else
-            pTAutoFormat = new SwTableAutoFormat( (*m_xTableTable)[ tbIndex ] );
+            m_xTAutoFormat.reset(new SwTableAutoFormat( (*m_xTableTable)[ tbIndex ] ));
     }
     else
     {
-        delete pTAutoFormat;
-        pTAutoFormat = new SwTableAutoFormat( SwViewShell::GetShellRes()->aStrNone );
-        lcl_SetProperties( pTAutoFormat, false );
+        m_xTAutoFormat.reset(new SwTableAutoFormat( SwViewShell::GetShellRes()->aStrNone ));
+        lcl_SetProperties( m_xTAutoFormat.get(), false );
     }
 
     m_xDialog->response(RET_OK);
diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx
index 593d3668cd31..381b1ba4f39a 100644
--- a/sw/source/uibase/inc/instable.hxx
+++ b/sw/source/uibase/inc/instable.hxx
@@ -38,7 +38,7 @@ class SwInsTableDlg : public SfxDialogController
 
     SwWrtShell* pShell;
     std::unique_ptr<SwTableAutoFormatTable> m_xTableTable;
-    SwTableAutoFormat* pTAutoFormat;
+    std::unique_ptr<SwTableAutoFormat> m_xTAutoFormat;
 
     sal_uInt8 lbIndex;
     sal_uInt8 tbIndex;


More information about the Libreoffice-commits mailing list