From d7453ed1d3ede8c34bdd5f3bf9b642a3734de0d2 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 23 Aug 2021 17:03:21 +0200 Subject: osl::Mutex->std::mutex in SfxViewShell_Impl Change-Id: Ic053a56f51714d7bb63009747cd93e98fcb9c438 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120906 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/view/viewimp.hxx | 10 ++++++---- sfx2/source/view/viewsh.cxx | 14 +++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index f4d3bb6b6f10..cf6892dec4e9 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -20,10 +20,11 @@ #ifndef INCLUDED_SFX2_SOURCE_VIEW_VIEWIMP_HXX #define INCLUDED_SFX2_SOURCE_VIEW_VIEWIMP_HXX +#include #include #include -#include -#include +#include +#include #include #include #include @@ -35,8 +36,9 @@ class SfxClipboardChangeListener; struct SfxViewShell_Impl { - ::osl::Mutex aMutex; - ::comphelper::OInterfaceContainerHelper2 aInterceptorContainer; + std::mutex aMutex; + ::comphelper::OInterfaceContainerHelper4 + aInterceptorContainer; SfxShellArr_Impl aArr; Size aMargin; bool m_bHasPrintOptions; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index c58f5b2fdbd8..920ffd6090a1 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -219,7 +219,7 @@ void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::c sal_uInt32 SfxViewShell_Impl::m_nLastViewShellId = 0; SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags, ViewShellDocId nDocId) -: aInterceptorContainer( aMutex ) +: aInterceptorContainer() , m_bHasPrintOptions(nFlags & SfxViewShellFlags::HAS_PRINTOPTIONS) , m_nFamily(0xFFFF) // undefined, default set by TemplateDialog , m_pLibreOfficeKitViewCallback(nullptr) @@ -1846,7 +1846,9 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuI aEvent.Selection.set( GetController(), uno::UNO_QUERY ); // call interceptors - ::comphelper::OInterfaceIteratorHelper2 aIt( pImpl->aInterceptorContainer ); + std::unique_lock g(pImpl->aMutex); + ::comphelper::OInterfaceIteratorHelper4 aIt( pImpl->aInterceptorContainer ); + g.unlock(); while( aIt.hasMoreElements() ) { try @@ -1854,7 +1856,7 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuI ui::ContextMenuInterceptorAction eAction; { SolarMutexReleaser rel; - eAction = static_cast(aIt.next())->notifyContextMenuExecute( aEvent ); + eAction = aIt.next()->notifyContextMenuExecute( aEvent ); } switch ( eAction ) { @@ -1908,7 +1910,9 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rMenu, const OUString& rMen aEvent.Selection = css::uno::Reference< css::view::XSelectionSupplier >( GetController(), css::uno::UNO_QUERY ); // call interceptors - ::comphelper::OInterfaceIteratorHelper2 aIt( pImpl->aInterceptorContainer ); + std::unique_lock g(pImpl->aMutex); + ::comphelper::OInterfaceIteratorHelper4 aIt( pImpl->aInterceptorContainer ); + g.unlock(); while( aIt.hasMoreElements() ) { try @@ -1916,7 +1920,7 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rMenu, const OUString& rMen css::ui::ContextMenuInterceptorAction eAction; { SolarMutexReleaser rel; - eAction = static_cast< css::ui::XContextMenuInterceptor* >( aIt.next() )->notifyContextMenuExecute( aEvent ); + eAction = aIt.next()->notifyContextMenuExecute( aEvent ); } switch ( eAction ) { -- cgit