CID#1103720 make leak impossible

Change-Id: Ife34807a447aae474f1df29ce22f50b9e9d9cacf
This commit is contained in:
Caolán McNamara
2013-10-10 20:05:08 +01:00
parent 700883b34e
commit 95e582de1d

View File

@@ -1625,8 +1625,8 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); sal_uInt16 nSelPos = pBox->GetSelectEntryPos();
if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos) if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos)
{ {
boost::scoped_ptr<SvxBrushItem> xItemHolder;
SvxBrushItem* pActItem = NULL; SvxBrushItem* pActItem = NULL;
bool bDelete = false;
sal_uInt16 nWhich = 0; sal_uInt16 nWhich = 0;
switch(pTableBck_Impl->nActPos) switch(pTableBck_Impl->nActPos)
{ {
@@ -1649,8 +1649,8 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
pTableBck_Impl->nActPos = nSelPos; pTableBck_Impl->nActPos = nSelPos;
if(!pActItem) if(!pActItem)
{ {
pActItem = new SvxBrushItem(nWhich); xItemHolder.reset(new SvxBrushItem(nWhich));
bDelete = true; pActItem = xItemHolder.get();
} }
if(XFILL_SOLID == lcl_getFillStyle(m_pLbSelect)) // brush selected if(XFILL_SOLID == lcl_getFillStyle(m_pLbSelect)) // brush selected
{ {
@@ -1693,25 +1693,19 @@ IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox )
nWhich = pTableBck_Impl->nTableWhich; nWhich = pTableBck_Impl->nTableWhich;
break; break;
default: default:
if (bDelete) // The item will be new'ed again below, but that will be the
{ // default item then, not an existing modified one.
// The item will be new'ed again below, but that will be the xItemHolder.reset();
// default item then, not an existing modified one.
delete pActItem;
bDelete = false;
}
pActItem = NULL; pActItem = NULL;
break; break;
} }
OUString aUserData = GetUserData(); OUString aUserData = GetUserData();
if(!pActItem) if (!pActItem)
{ {
pActItem = new SvxBrushItem(nWhich); xItemHolder.reset(new SvxBrushItem(nWhich));
bDelete = true; pActItem = xItemHolder.get();
} }
FillControls_Impl(*pActItem, aUserData); FillControls_Impl(*pActItem, aUserData);
if (bDelete)
delete pActItem;
} }
return 0; return 0;
} }