diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-05-07 21:06:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-08 16:38:31 +0200 |
commit | 40b0cf86c23d72af90f964597ac814ceaf846259 (patch) | |
tree | 3ad694dcc19186c92846233444574f71d2d1bd17 /sfx2 | |
parent | df63d1aa9ca0676e3df7b68dc8dc99246aa44240 (diff) |
osl::Mutex->std::mutex in sfx2::PreventDuplicateInteraction
Change-Id: I4abc1462b4d691dc699a9716573d23824897176b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134015
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/preventduplicateinteraction.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/appl/preventduplicateinteraction.cxx | 18 |
2 files changed, 11 insertions, 10 deletions
diff --git a/sfx2/inc/preventduplicateinteraction.hxx b/sfx2/inc/preventduplicateinteraction.hxx index a5eb448eca60..62e59dd96c2e 100644 --- a/sfx2/inc/preventduplicateinteraction.hxx +++ b/sfx2/inc/preventduplicateinteraction.hxx @@ -34,6 +34,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/wrkwin.hxx> #include <vcl/svapp.hxx> +#include <mutex> namespace com::sun::star::uno { class XComponentContext; @@ -152,7 +153,7 @@ public: class PreventDuplicateInteraction final : public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2> { - mutable ::osl::Mutex m_aLock; + mutable std::mutex m_aLock; // structs, types etc. public: diff --git a/sfx2/source/appl/preventduplicateinteraction.cxx b/sfx2/source/appl/preventduplicateinteraction.cxx index 0c32b34f3503..31dcd113b66b 100644 --- a/sfx2/source/appl/preventduplicateinteraction.cxx +++ b/sfx2/source/appl/preventduplicateinteraction.cxx @@ -39,7 +39,7 @@ PreventDuplicateInteraction::~PreventDuplicateInteraction() void PreventDuplicateInteraction::setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); m_xWarningDialogsParent.reset(); m_xHandler = xHandler; // <- SAFE @@ -54,7 +54,7 @@ void PreventDuplicateInteraction::useDefaultUUIHandler() m_xContext, m_xWarningDialogsParent->GetDialogParent()), css::uno::UNO_QUERY_THROW); // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); m_xHandler = xHandler; // <- SAFE } @@ -63,7 +63,7 @@ css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::u { if ( aType.equals( cppu::UnoType<XInteractionHandler2>::get() ) ) { - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); if ( !xHandler.is() ) return css::uno::Any(); @@ -77,7 +77,7 @@ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css bool bHandleIt = true; // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(), [&aRequest](const InteractionInfo& rInfo) { return aRequest.isExtractableTo(rInfo.m_aInteraction); }); @@ -92,7 +92,7 @@ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css css::uno::Reference< css::task::XInteractionHandler > xHandler = m_xHandler; - aLock.clear(); + aLock.unlock(); // <- SAFE if ( bHandleIt && xHandler.is() ) @@ -120,7 +120,7 @@ sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const c bool bHandleIt = true; // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(), [&aRequest](const InteractionInfo& rInfo) { return aRequest.isExtractableTo(rInfo.m_aInteraction); }); @@ -137,7 +137,7 @@ sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const c OSL_ENSURE( xHandler.is() || !m_xHandler.is(), "PreventDuplicateInteraction::handleInteractionRequest: inconsistency!" ); - aLock.clear(); + aLock.unlock(); // <- SAFE if ( bHandleIt && xHandler.is() ) @@ -163,7 +163,7 @@ sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const c void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(), [&aInteractionInfo](const InteractionInfo& rInfo) { return rInfo.m_aInteraction == aInteractionInfo.m_aInteraction; }); @@ -183,7 +183,7 @@ bool PreventDuplicateInteraction::getInteractionInfo(const css::uno::Type& PreventDuplicateInteraction::InteractionInfo* pReturn ) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aLock); auto pIt = std::find_if(m_lInteractionRules.begin(), m_lInteractionRules.end(), [&aInteraction](const InteractionInfo& rInfo) { return rInfo.m_aInteraction == aInteraction; }); |