summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-08-10 17:14:50 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-08-12 22:52:17 +0200
commit52d87ec0046d002ee67482671ad67bf5b9b4268b (patch)
tree74403b5ae76b4df6744663a63f408529f5fda1b7 /sw
parent6d6671b1779a74f35d29a68dd4802afdf7c6a5c1 (diff)
sw: Immediately construct a shared_ptr instead of raw pointer
Change-Id: Id6e212ae143133ea1899c585f18986c02bf3a58d Reviewed-on: https://gerrit.libreoffice.org/77363 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/tabsh.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index b36d1b65fb4c..4a37848da7a7 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -138,8 +138,10 @@ static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem )
rSh.SetTableAttr( aSet );
}
-static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
+static std::shared_ptr<SwTableRep> lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
{
+ std::shared_ptr<SwTableRep> pRep;
+
SwFrameFormat *pFormat = rSh.GetTableFormat();
SwTabCols aCols;
rSh.GetTabCols( aCols );
@@ -220,7 +222,7 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
rSh.GetTabCols( aTabCols );
// Pointer will be deleted after the dialogue execution.
- SwTableRep* pRep = new SwTableRep( aTabCols );
+ pRep = std::make_shared<SwTableRep>(aTabCols);
pRep->SetSpace(aCols.GetRightMax());
sal_uInt16 nPercent = 0;
@@ -266,7 +268,7 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
pRep->SetWidthPercent(nPercent);
// Are individual rows / cells are selected, the column processing will be changed.
pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection());
- rSet.Put(SwPtrItem(FN_TABLE_REP, pRep));
+ rSet.Put(SwPtrItem(FN_TABLE_REP, pRep.get()));
return pRep;
}