diff options
Diffstat (limited to 'unotools/source/config/itemholder1.cxx')
-rw-r--r-- | unotools/source/config/itemholder1.cxx | 23 |
1 files changed, 8 insertions, 15 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: */ |