summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unotools/source/config/itemholder1.cxx23
-rw-r--r--unotools/source/config/itemholder1.hxx1
2 files changed, 8 insertions, 16 deletions
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index b845b9f8eb00..ea658bc0dc1d 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -112,17 +112,19 @@ void ItemHolder1::impl_addItem(EItem eItem)
void ItemHolder1::impl_releaseAllItems()
{
- ::osl::ResettableMutexGuard aLock(m_aLock);
+ TItems items;
+ {
+ ::osl::MutexGuard aLock(m_aLock);
+ items.swap(m_lItems);
+ }
TItems::iterator pIt;
- for ( pIt = m_lItems.begin();
- pIt != m_lItems.end();
+ for ( pIt = items.begin();
+ pIt != items.end();
++pIt )
{
- TItemInfo& rInfo = *pIt;
- impl_deleteItem(rInfo);
+ delete pIt->pItem;
}
- m_lItems.clear();
}
void ItemHolder1::impl_newItem(TItemInfo& rItem)
@@ -223,13 +225,4 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
}
}
-void ItemHolder1::impl_deleteItem(TItemInfo& rItem)
-{
- if (rItem.pItem)
- {
- delete rItem.pItem;
- rItem.pItem = nullptr;
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/itemholder1.hxx b/unotools/source/config/itemholder1.hxx
index c181c579da1f..406a34eaec56 100644
--- a/unotools/source/config/itemholder1.hxx
+++ b/unotools/source/config/itemholder1.hxx
@@ -51,7 +51,6 @@ class ItemHolder1 : private ItemHolderMutexBase
void impl_addItem(EItem eItem);
void impl_releaseAllItems();
static void impl_newItem(TItemInfo& rItem);
- static void impl_deleteItem(TItemInfo& rItem);
};
// namespaces