diff options
Diffstat (limited to 'svtools/source/config/itemholder2.cxx')
-rw-r--r-- | svtools/source/config/itemholder2.cxx | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index bdfb27387a8d..5989157f5e8b 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -111,15 +111,18 @@ void ItemHolder2::impl_addItem(EItem eItem) void ItemHolder2::impl_releaseAllItems() { - ::osl::ResettableMutexGuard aLock(m_aLock); + TItems items; + { + ::osl::ResettableMutexGuard 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(); } @@ -163,16 +166,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) } } - -void ItemHolder2::impl_deleteItem(TItemInfo& rItem) -{ - if (rItem.pItem) - { - delete rItem.pItem; - rItem.pItem = nullptr; - } -} - } // namespace svtools /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |