diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-12-25 19:04:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-27 07:34:57 +0100 |
commit | ad492932e9b64991001a0eb5e0aa1fa7801bb3fa (patch) | |
tree | 0f2110a63703f7dacf0a9ef46ddaca9c24b21962 /sfx2 | |
parent | 26048e4f37cc0c595dc25dd07698aad82180fb3e (diff) |
use comphelper::WeakComponentImplHelper in ShutdownIcon
Change-Id: I1cb6292e981948e9a1ff9ce339d037540ade9614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127525
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/appl/shutdownicon.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/shutdowniconaqua.mm | 1 |
3 files changed, 10 insertions, 12 deletions
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 8d221e07d90e..fd81eb41837b 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -140,7 +140,6 @@ void ShutdownIcon::deInitSystray() ShutdownIcon::ShutdownIcon( const css::uno::Reference< XComponentContext > & rxContext ) : - ShutdownIconServiceBase( m_aMutex ), m_bVeto ( false ), m_bListenForTermination ( false ), m_bSystemDialogs( false ), @@ -466,12 +465,12 @@ ShutdownIcon* ShutdownIcon::createInstance() void ShutdownIcon::init() { css::uno::Reference < XDesktop2 > xDesktop = Desktop::create( m_xContext ); - osl::MutexGuard aGuard(m_aMutex); + std::unique_lock aGuard(m_aMutex); m_xDesktop = xDesktop; } -void SAL_CALL ShutdownIcon::disposing() +void ShutdownIcon::disposing(std::unique_lock<std::mutex>&) { m_xContext.clear(); m_xDesktop.clear(); @@ -490,7 +489,7 @@ void SAL_CALL ShutdownIcon::disposing( const css::lang::EventObject& ) void SAL_CALL ShutdownIcon::queryTermination( const css::lang::EventObject& ) { SAL_INFO("sfx.appl", "ShutdownIcon::queryTermination: veto is " << m_bVeto); - osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( m_bVeto ) throw css::frame::TerminationVetoException(); @@ -504,7 +503,7 @@ void SAL_CALL ShutdownIcon::notifyTermination( const css::lang::EventObject& ) void SAL_CALL ShutdownIcon::initialize( const css::uno::Sequence< css::uno::Any>& aArguments ) { - ::osl::ResettableMutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); // third argument only sets veto, everything else will be ignored! if (aArguments.getLength() > 2) @@ -523,9 +522,9 @@ void SAL_CALL ShutdownIcon::initialize( const css::uno::Sequence< css::uno::Any> bool bQuickstart = ::cppu::any2bool( aArguments[0] ); if( !bQuickstart && !GetAutostart() ) return; - aGuard.clear(); + aGuard.unlock(); init (); - aGuard.reset(); + aGuard.lock(); if ( !m_xDesktop.is() ) return; diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx index 32113cbc1ee2..cb352e60b443 100644 --- a/sfx2/source/appl/shutdownicon.hxx +++ b/sfx2/source/appl/shutdownicon.hxx @@ -28,8 +28,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ustring.hxx> #include <rtl/ref.hxx> -#include <osl/mutex.hxx> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <tools/link.hxx> #include <memory> @@ -45,7 +44,7 @@ namespace sfx2 class FileDialogHelper; } -typedef ::cppu::WeakComponentImplHelper< +typedef comphelper::WeakComponentImplHelper< css::lang::XInitialization, css::frame::XTerminateListener, css::lang::XServiceInfo, @@ -62,7 +61,6 @@ typedef ::cppu::WeakComponentImplHelper< class ShutdownIcon : public ShutdownIconServiceBase { - ::osl::Mutex m_aMutex; bool m_bVeto; bool m_bListenForTermination; bool m_bSystemDialogs; @@ -120,7 +118,7 @@ class ShutdownIcon : public ShutdownIconServiceBase static bool IsQuickstarterInstalled(); // Component Helper - force override - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm index 7e8bf071c95f..74a9602e6ce1 100644 --- a/sfx2/source/appl/shutdowniconaqua.mm +++ b/sfx2/source/appl/shutdowniconaqua.mm @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <tools/urlobj.hxx> #include <osl/file.h> +#include <osl/diagnose.h> #include <comphelper/sequenceashashmap.hxx> #include <sfx2/app.hxx> #include <sal/macros.h> |