summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/tabsh.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-31 09:23:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-09 06:41:05 +0100
commitee204f8f54de5bef526f2ad7fc78a425b196bb63 (patch)
tree76f06140e2b884fec421fba9775cb71cecd5e650 /sw/source/uibase/shells/tabsh.cxx
parent939de6a6a262b354a291981f62f00310776d63e7 (diff)
loplugin:useuniqueptr in SwDoc::GetRowHeight and GetRowSplit
fixing a memory leak in the process Change-Id: I1b168159a8aa23e392768c49127f42b72e1ce3b3 Reviewed-on: https://gerrit.libreoffice.org/63128 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/shells/tabsh.cxx')
-rw-r--r--sw/source/uibase/shells/tabsh.cxx22
1 files changed, 8 insertions, 14 deletions
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index b8da4958ede3..4b3c3dc78f41 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -203,12 +203,11 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
rSh.GetTabBorders( rSet );
//row split
- SwFormatRowSplit* pSplit = nullptr;
- rSh.GetRowSplit(pSplit);
+ std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
if(pSplit)
{
rSet.Put(*pSplit);
- delete pSplit;
+ pSplit.reset();
}
if(!bTableSel)
@@ -1184,21 +1183,20 @@ void SwTableShell::Execute(SfxRequest &rReq)
case FN_TABLE_ROW_SPLIT :
{
const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
- SwFormatRowSplit* pSplit = nullptr;
+ std::unique_ptr<SwFormatRowSplit> pSplit;
if(!pBool)
{
- rSh.GetRowSplit(pSplit);
+ pSplit = rSh.GetRowSplit();
if(pSplit)
pSplit->SetValue(!pSplit->GetValue());
else
- pSplit = new SwFormatRowSplit(true);
+ pSplit.reset(new SwFormatRowSplit(true));
}
else
{
- pSplit = new SwFormatRowSplit(pBool->GetValue());
+ pSplit.reset(new SwFormatRowSplit(pBool->GetValue()));
}
rSh.SetRowSplit( *pSplit );
- delete pSplit;
break;
}
@@ -1268,13 +1266,11 @@ void SwTableShell::GetState(SfxItemSet &rSet)
case SID_TABLE_MINIMAL_ROW_HEIGHT:
{
// Disable if auto height already is enabled.
- SwFormatFrameSize *pSz;
- rSh.GetRowHeight( pSz );
+ std::unique_ptr<SwFormatFrameSize> pSz = rSh.GetRowHeight();
if ( pSz )
{
if ( ATT_VAR_SIZE == pSz->GetHeightSizeType() )
rSet.DisableItem( nSlot );
- delete pSz;
}
break;
}
@@ -1365,13 +1361,11 @@ void SwTableShell::GetState(SfxItemSet &rSet)
}
else
{
- SwFormatRowSplit* pSplit = nullptr;
- rSh.GetRowSplit(pSplit);
+ std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
if(pSplit)
rSet.Put(*pSplit);
else
rSet.InvalidateItem( nSlot );
- delete pSplit;
}
break;
}