[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 26 13:16:39 UTC 2021
sw/source/ui/table/instable.cxx | 18 +++++++++---------
sw/source/uibase/inc/instable.hxx | 3 ++-
2 files changed, 11 insertions(+), 10 deletions(-)
New commits:
commit 90da191bc937eedd2a7fda4ac41fbe6a53356842
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 26 10:18:05 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed May 26 15:15:51 2021 +0200
fix leak in SwInsTableDlg
Change-Id: I1d4b4f5098eeec7b0042f3ffd457566ecb3e31de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116188
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 6ace6f4bc10d..4990f7c08112 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -130,17 +130,17 @@ void SwInsTableDlg::InitAutoTableFormat()
m_xLbFormat->connect_changed(LINK(this, SwInsTableDlg, SelFormatHdl));
- pTableTable = new SwTableAutoFormatTable;
- pTableTable->Load();
+ m_xTableTable.reset(new SwTableAutoFormatTable);
+ m_xTableTable->Load();
// Add "- none -" style autoformat table.
m_xLbFormat->append_text(SwViewShell::GetShellRes()->aStrNone); // Insert to listbox
// Add other styles of autoformat tables.
- for (sal_uInt8 i = 0, nCount = static_cast<sal_uInt8>(pTableTable->size());
+ for (sal_uInt8 i = 0, nCount = static_cast<sal_uInt8>(m_xTableTable->size());
i < nCount; i++)
{
- SwTableAutoFormat const& rFormat = (*pTableTable)[ i ];
+ SwTableAutoFormat const& rFormat = (*m_xTableTable)[ i ];
m_xLbFormat->append_text(rFormat.GetName());
if (pTAutoFormat && rFormat.GetName() == pTAutoFormat->GetName())
lbIndex = i;
@@ -148,7 +148,7 @@ void SwInsTableDlg::InitAutoTableFormat()
// Change this min variable if you add autotable manually.
minTableIndexInLb = 1;
- maxTableIndexInLb = minTableIndexInLb + static_cast<sal_uInt8>(pTableTable->size());
+ maxTableIndexInLb = minTableIndexInLb + static_cast<sal_uInt8>(m_xTableTable->size());
lbIndex = 0;
m_xLbFormat->select( lbIndex );
tbIndex = lbIndexToTableIndex(lbIndex);
@@ -187,7 +187,7 @@ IMPL_LINK_NOARG(SwInsTableDlg, SelFormatHdl, weld::TreeView&, void)
// To understand this index mapping, look InitAutoTableFormat function to
// see how listbox item is implemented.
if( tbIndex < 255 )
- m_aWndPreview.NotifyChange( (*pTableTable)[tbIndex] );
+ m_aWndPreview.NotifyChange( (*m_xTableTable)[tbIndex] );
else
{
SwTableAutoFormat aTmp( SwViewShell::GetShellRes()->aStrNone );
@@ -200,14 +200,14 @@ IMPL_LINK_NOARG(SwInsTableDlg, SelFormatHdl, weld::TreeView&, void)
IMPL_LINK_NOARG(SwInsTableDlg, OKHdl, weld::Button&, void)
{
if( tbIndex < 255 )
- pShell->SetTableStyle((*pTableTable)[tbIndex]);
+ pShell->SetTableStyle((*m_xTableTable)[tbIndex]);
if( tbIndex < 255 )
{
if( pTAutoFormat )
- *pTAutoFormat = (*pTableTable)[ tbIndex ];
+ *pTAutoFormat = (*m_xTableTable)[ tbIndex ];
else
- pTAutoFormat = new SwTableAutoFormat( (*pTableTable)[ tbIndex ] );
+ pTAutoFormat = new SwTableAutoFormat( (*m_xTableTable)[ tbIndex ] );
}
else
{
diff --git a/sw/source/uibase/inc/instable.hxx b/sw/source/uibase/inc/instable.hxx
index e802503c3fb2..593d3668cd31 100644
--- a/sw/source/uibase/inc/instable.hxx
+++ b/sw/source/uibase/inc/instable.hxx
@@ -30,13 +30,14 @@
#include <view.hxx>
#include <tblafmt.hxx>
#include <itabenum.hxx>
+#include <memory>
class SwInsTableDlg : public SfxDialogController
{
TextFilter m_aTextFilter;
SwWrtShell* pShell;
- SwTableAutoFormatTable* pTableTable;
+ std::unique_ptr<SwTableAutoFormatTable> m_xTableTable;
SwTableAutoFormat* pTAutoFormat;
sal_uInt8 lbIndex;
More information about the Libreoffice-commits
mailing list