From 87030862d4750b456f876dc48310d87ed48848f0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 7 Feb 2020 21:07:41 +0200 Subject: 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 --- framework/source/services/desktop.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'framework/source') 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 > xComponentDllListeners = m_xComponentDllListeners; + std::vector< css::uno::Reference > 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 > xComponentDllListeners = m_xComponentDllListeners; + std::vector< css::uno::Reference > xComponentDllListeners; + xComponentDllListeners.swap(m_xComponentDllListeners); for (auto& xListener: xComponentDllListeners) { xListener->disposing(aEvent); } xComponentDllListeners.clear(); - m_xComponentDllListeners.clear(); m_xSfxTerminator.clear(); m_xCommandOptions.reset(); -- cgit