summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx4
-rw-r--r--framework/source/services/desktop.cxx9
-rw-r--r--svtools/source/control/valueacc.cxx6
-rw-r--r--toolkit/source/awt/vclxwindow.cxx3
5 files changed, 13 insertions, 17 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
index 840f578aa17a..91040ee70671 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -374,11 +374,9 @@ void AccessibleBase::KillAllChildren()
{
ClearableMutexGuard aGuard( m_aMutex );
- // make local copy for notification
- ChildListVectorType aLocalChildList( m_aChildList );
-
- // remove all children
- m_aChildList.clear();
+ // make local copy for notification, and remove all children
+ ChildListVectorType aLocalChildList;
+ aLocalChildList.swap( m_aChildList );
m_aChildOIDMap.clear();
aGuard.clear();
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index c37994d7c0ba..6b4ab7f15ba7 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -276,7 +276,8 @@ void ODatabaseContext::disposing()
// dispose the data sources
// disposing seems to remove elements, so work on copy for valid iterators
- ObjectCache objCopy(m_aDatabaseObjects);
+ ObjectCache objCopy;
+ objCopy.swap(m_aDatabaseObjects);
for (auto const& elem : objCopy)
{
rtl::Reference< ODatabaseModelImpl > obj(elem.second);
@@ -284,7 +285,6 @@ void ODatabaseContext::disposing()
// dispose()
obj->dispose();
}
- m_aDatabaseObjects.clear();
}
// XNamingService
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 94f41f9fa1af..8b20e591a24d 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -338,12 +338,13 @@ sal_Bool SAL_CALL Desktop::terminate()
xPipeTerminator->notifyTermination( aEvent );
// we need a copy here as the notifyTermination call might cause a removeTerminateListener call
- std::vector< css::uno::Reference<css::frame::XTerminateListener> > xComponentDllListeners = m_xComponentDllListeners;
+ std::vector< css::uno::Reference<css::frame::XTerminateListener> > xComponentDllListeners;
+ xComponentDllListeners.swap(m_xComponentDllListeners);
for (auto& xListener : xComponentDllListeners)
{
xListener->notifyTermination(aEvent);
}
- m_xComponentDllListeners.clear();
+ xComponentDllListeners.clear();
// Must be really the last listener to be called.
// Because it shutdown the whole process asynchronous !
@@ -1104,13 +1105,13 @@ void SAL_CALL Desktop::disposing()
m_xSWThreadManager.clear();
// we need a copy because the disposing might call the removeEventListener method
- std::vector< css::uno::Reference<css::frame::XTerminateListener> > xComponentDllListeners = m_xComponentDllListeners;
+ std::vector< css::uno::Reference<css::frame::XTerminateListener> > xComponentDllListeners;
+ xComponentDllListeners.swap(m_xComponentDllListeners);
for (auto& xListener: xComponentDllListeners)
{
xListener->disposing(aEvent);
}
xComponentDllListeners.clear();
- m_xComponentDllListeners.clear();
m_xSfxTerminator.clear();
m_xCommandOptions.reset();
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 0b1e412ea3f4..e205a937429b 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -619,8 +619,7 @@ void SAL_CALL ValueSetAcc::disposing()
// Make a copy of the list and clear the original.
const SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (m_aMutex);
- aListenerListCopy = mxEventListeners;
- mxEventListeners.clear();
+ aListenerListCopy.swap(mxEventListeners);
// Reset the pointer to the parent. It has to be the one who has
// disposed us because he is dying.
@@ -1943,8 +1942,7 @@ void SAL_CALL SvtValueSetAcc::disposing()
// Make a copy of the list and clear the original.
const SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard (m_aMutex);
- aListenerListCopy = mxEventListeners;
- mxEventListeners.clear();
+ aListenerListCopy.swap(mxEventListeners);
// Reset the pointer to the parent. It has to be the one who has
// disposed us because he is dying.
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 1381a7fa3570..f33daf8eee3e 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -269,8 +269,7 @@ IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks, void*, void)
CallbackArray aCallbacksCopy;
{
SolarMutexGuard aGuard;
- aCallbacksCopy = maCallbackEvents;
- maCallbackEvents.clear();
+ aCallbacksCopy.swap(maCallbackEvents);
// we acquired our VCLXWindow once before posting the event, release this one ref now
mrAntiImpl.release();