diff options
-rw-r--r-- | svl/source/config/itemholder2.cxx | 23 | ||||
-rw-r--r-- | svl/source/config/itemholder2.hxx | 1 |
2 files changed, 8 insertions, 16 deletions
diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index c7ab2bfb4b26..1511b47082a3 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -98,17 +98,19 @@ void ItemHolder2::impl_addItem(EItem eItem) void ItemHolder2::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 ItemHolder2::impl_newItem(TItemInfo& rItem) @@ -129,13 +131,4 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) } } -void ItemHolder2::impl_deleteItem(TItemInfo& rItem) -{ - if (rItem.pItem) - { - delete rItem.pItem; - rItem.pItem = nullptr; - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/config/itemholder2.hxx b/svl/source/config/itemholder2.hxx index d0348ef6e0f5..3246cc37b4dd 100644 --- a/svl/source/config/itemholder2.hxx +++ b/svl/source/config/itemholder2.hxx @@ -50,7 +50,6 @@ class ItemHolder2 : private ItemHolderMutexBase void impl_addItem(EItem eItem); void impl_releaseAllItems(); static void impl_newItem(TItemInfo& rItem); - static void impl_deleteItem(TItemInfo& rItem); }; #endif // INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ |