summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/tbcontrl.hxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx16
2 files changed, 6 insertions, 12 deletions
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 1f5079f69a22..bf089f87153a 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -190,7 +190,7 @@ private:
SfxStyleSheetBasePool* pStyleSheetPool;
SfxStyleControllerItem_Impl* pBoundItems[MAX_FAMILIES];
css::uno::Reference<css::lang::XComponent> m_xBoundItems[MAX_FAMILIES];
- SfxTemplateItem* pFamilyState[MAX_FAMILIES];
+ std::unique_ptr<SfxTemplateItem> pFamilyState[MAX_FAMILIES];
sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
SVX_DLLPRIVATE void Update();
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8b63a0f45ef3..882bb7194566 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2359,8 +2359,7 @@ void SAL_CALL SvxStyleToolBoxControl::dispose()
m_xBoundItems[i].clear();
pBoundItems[i] = nullptr;
}
- delete pFamilyState[i];
- pFamilyState[i] = nullptr;
+ pFamilyState[i].reset();
}
pStyleSheetPool = nullptr;
pImpl.reset();
@@ -2547,17 +2546,17 @@ void SvxStyleToolBoxControl::Update()
const SfxTemplateItem* pItem = nullptr;
- if ( nActFamily == 0xffff || nullptr == (pItem = pFamilyState[nActFamily-1]) )
+ if ( nActFamily == 0xffff || nullptr == (pItem = pFamilyState[nActFamily-1].get()) )
// Current range not within allowed ranges or default
{
pStyleSheetPool = pPool;
nActFamily = 2;
- pItem = pFamilyState[nActFamily-1];
+ pItem = pFamilyState[nActFamily-1].get();
if ( !pItem )
{
nActFamily++;
- pItem = pFamilyState[nActFamily-1];
+ pItem = pFamilyState[nActFamily-1].get();
}
if ( !pItem )
@@ -2577,12 +2576,7 @@ void SvxStyleToolBoxControl::Update()
void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx,
const SfxTemplateItem* pItem )
{
- delete pFamilyState[nIdx];
- pFamilyState[nIdx] = nullptr;
-
- if ( pItem )
- pFamilyState[nIdx] = new SfxTemplateItem( *pItem );
-
+ pFamilyState[nIdx].reset( pItem == nullptr ? nullptr : new SfxTemplateItem( *pItem ) );
Update();
}