diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-04-08 09:58:11 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-04-12 10:54:39 +0200 |
commit | ec58b30529c33e5190244c06feb200c6a6510ed3 (patch) | |
tree | af0a750bc67d8cfa7f3c93a25323a1a65e132341 /sw | |
parent | d8c6730472a002483740bc794febe1323b474ceb (diff) |
Fix regressions from d727476cff29382a34103b137542e15e1aeeb4b9
Calls to statusChanged may call addStatusListener or removeStatusListener
so copy m_aStatusListenerVector on stack and iterate on the copy
Thank you Michael for having pointed these
Change-Id: I8399db84874d7f68e24c57891a9ab408e7ebef78
Reviewed-on: https://gerrit.libreoffice.org/52579
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 8fced3ec9ff6f55a6e0b939183cf33b6c3c4a1db)
Reviewed-on: https://gerrit.libreoffice.org/52584
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 1e80227ff76896a2bb6243acff19a49567bb2387)
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/uno/unodispatch.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx index fb6c66b38442..acb2496b4b81 100644 --- a/sw/source/uibase/uno/unodispatch.cxx +++ b/sw/source/uibase/uno/unodispatch.cxx @@ -257,7 +257,10 @@ void SwXDispatch::dispatch(const util::URL& aURL, aEvent.State <<= aDescriptor.createPropertyValueSequence(); aEvent.IsEnabled = !rData.sDataSource.isEmpty(); - for ( auto & status : m_aStatusListenerVector ) + // calls to statusChanged may call addStatusListener or removeStatusListener + // so copy m_aStatusListenerVector on stack + auto copyStatusListenerVector = m_aStatusListenerVector; + for (auto & status : copyStatusListenerVector) { if(status.aURL.Complete == cURLDocumentDataSource) { @@ -348,7 +351,10 @@ void SwXDispatch::selectionChanged( const lang::EventObject& ) aEvent.IsEnabled = bEnable; aEvent.Source = *static_cast<cppu::OWeakObject*>(this); - for ( auto & status : m_aStatusListenerVector ) + // calls to statusChanged may call addStatusListener or removeStatusListener + // so copy m_aStatusListenerVector on stack + auto copyStatusListenerVector = m_aStatusListenerVector; + for (auto & status : copyStatusListenerVector) { aEvent.FeatureURL = status.aURL; if (status.aURL.Complete != cURLDocumentDataSource) @@ -367,7 +373,10 @@ void SwXDispatch::disposing( const lang::EventObject& rSource ) lang::EventObject aObject; aObject.Source = static_cast<cppu::OWeakObject*>(this); - for ( auto & status : m_aStatusListenerVector ) + // calls to statusChanged may call addStatusListener or removeStatusListener + // so copy m_aStatusListenerVector on stack + auto copyStatusListenerVector = m_aStatusListenerVector; + for (auto & status : copyStatusListenerVector) { status.xListener->disposing(aObject); } |