[Libreoffice-commits] core.git: chart2/source dbaccess/source framework/source svtools/source toolkit/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 8 10:23:52 UTC 2020
chart2/source/controller/accessibility/AccessibleBase.cxx | 8 +++-----
dbaccess/source/core/dataaccess/databasecontext.cxx | 4 ++--
framework/source/services/desktop.cxx | 9 +++++----
svtools/source/control/valueacc.cxx | 6 ++----
toolkit/source/awt/vclxwindow.cxx | 3 +--
5 files changed, 13 insertions(+), 17 deletions(-)
New commits:
commit 87030862d4750b456f876dc48310d87ed48848f0
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Fri Feb 7 21:07:41 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Feb 8 11:23:19 2020 +0100
replace some more copy/clear with swap
Change-Id: I6501dd59682d2605e9b9856c2deaa02a873ce641
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88239
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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();
More information about the Libreoffice-commits
mailing list