summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-26 10:53:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-26 16:08:22 +0200
commitea4b99c294aa4ad975a8374f317b09f743aa173e (patch)
treee7fd4d06ebe5c9f0e5063fa495b7868eb9559710
parentfix callgrind job by providing dummy privacy-url (diff)
downloadcore-ea4b99c294aa4ad975a8374f317b09f743aa173e.tar.gz
core-ea4b99c294aa4ad975a8374f317b09f743aa173e.zip
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@collabora.co.uk>
-rw-r--r--sw/source/ui/table/instable.cxx18
-rw-r--r--sw/source/uibase/inc/instable.hxx2
2 files changed, 9 insertions, 11 deletions
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;