summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-10 20:05:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-10-10 20:06:49 +0100
commit95e582de1dec6c7b98d498b158ab8a1f4813c24e (patch)
tree19918640ae7bc0d82bbb4c7eaf64bd6f52c2a5ea /cui
parent700883b34ebcdb77f398b4423f358bdf4648a853 (diff)
CID#1103720 make leak impossible
Change-Id: Ife34807a447aae474f1df29ce22f50b9e9d9cacf
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/backgrnd.cxx24
1 files changed, 9 insertions, 15 deletions
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index c52b4bad4557..cd829847a172 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -1625,8 +1625,8 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
sal_uInt16 nSelPos = pBox->GetSelectEntryPos();
if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos)
{
+ boost::scoped_ptr<SvxBrushItem> xItemHolder;
SvxBrushItem* pActItem = NULL;
- bool bDelete = false;
sal_uInt16 nWhich = 0;
switch(pTableBck_Impl->nActPos)
{
@@ -1649,8 +1649,8 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
pTableBck_Impl->nActPos = nSelPos;
if(!pActItem)
{
- pActItem = new SvxBrushItem(nWhich);
- bDelete = true;
+ xItemHolder.reset(new SvxBrushItem(nWhich));
+ pActItem = xItemHolder.get();
}
if(XFILL_SOLID == lcl_getFillStyle(m_pLbSelect)) // brush selected
{
@@ -1693,25 +1693,19 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
nWhich = pTableBck_Impl->nTableWhich;
break;
default:
- if (bDelete)
- {
- // The item will be new'ed again below, but that will be the
- // default item then, not an existing modified one.
- delete pActItem;
- bDelete = false;
- }
+ // The item will be new'ed again below, but that will be the
+ // default item then, not an existing modified one.
+ xItemHolder.reset();
pActItem = NULL;
break;
}
OUString aUserData = GetUserData();
- if(!pActItem)
+ if (!pActItem)
{
- pActItem = new SvxBrushItem(nWhich);
- bDelete = true;
+ xItemHolder.reset(new SvxBrushItem(nWhich));
+ pActItem = xItemHolder.get();
}
FillControls_Impl(*pActItem, aUserData);
- if (bDelete)
- delete pActItem;
}
return 0;
}