sfx2/source/view/viewimp.hxx |   10 ++++++----
 sfx2/source/view/viewsh.cxx  |   14 +++++++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit d7453ed1d3ede8c34bdd5f3bf9b642a3734de0d2
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Aug 23 17:03:21 2021 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Aug 24 14:41:21 2021 +0200

    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 <[email protected]>

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 <com/sun/star/ui/XContextMenuInterceptor.hpp>
 #include <memory>
 #include <sfx2/viewsh.hxx>
-#include <osl/mutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <mutex>
+#include <comphelper/interfacecontainer4.hxx>
 #include <svtools/acceleratorexecute.hxx>
 #include <rtl/ref.hxx>
 #include <vcl/print.hxx>
@@ -35,8 +36,9 @@ class SfxClipboardChangeListener;
 
 struct SfxViewShell_Impl
 {
-    ::osl::Mutex aMutex;
-    ::comphelper::OInterfaceContainerHelper2 aInterceptorContainer;
+    std::mutex aMutex;
+    ::comphelper::OInterfaceContainerHelper4<css::ui::XContextMenuInterceptor>
+        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<ui::XContextMenuInterceptor*>(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 )
             {

Reply via email to