diff options
Diffstat (limited to 'configmgr/source/readwriteaccess.cxx')
-rw-r--r-- | configmgr/source/readwriteaccess.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/configmgr/source/readwriteaccess.cxx b/configmgr/source/readwriteaccess.cxx index 1eddaaa9347d..18148b377c1d 100644 --- a/configmgr/source/readwriteaccess.cxx +++ b/configmgr/source/readwriteaccess.cxx @@ -22,9 +22,10 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> -#include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> +#include <mutex> +#include <utility> #include <sal/types.h> #include "components.hxx" @@ -42,8 +43,8 @@ class Service: { public: explicit Service( - css::uno::Reference< css::uno::XComponentContext > const & context): - context_(context) {} + css::uno::Reference< css::uno::XComponentContext > context): + context_(std::move(context)) {} private: Service(const Service&) = delete; @@ -97,7 +98,7 @@ private: css::uno::Reference< css::uno::XComponentContext > context_; - osl::Mutex mutex_; + std::mutex mutex_; rtl::Reference< RootAccess > root_; }; @@ -107,12 +108,12 @@ void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments) if (aArguments.getLength() != 1 || !(aArguments[0] >>= locale)) { throw css::lang::IllegalArgumentException( "not exactly one string argument", - static_cast< cppu::OWeakObject * >(this), -1); + getXWeak(), -1); } - osl::MutexGuard g1(mutex_); + std::unique_lock g1(mutex_); if (root_.is()) { throw css::uno::RuntimeException( - "already initialized", static_cast< cppu::OWeakObject * >(this)); + "already initialized", getXWeak()); } osl::MutexGuard g2(*lock()); Components & components = Components::getSingleton(context_); @@ -121,10 +122,10 @@ void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments) } rtl::Reference< RootAccess > Service::getRoot() { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); if (!root_.is()) { throw css::lang::NotInitializedException( - "not initialized", static_cast< cppu::OWeakObject * >(this)); + "not initialized", getXWeak()); } return root_; } @@ -136,7 +137,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* com_sun_star_comp_configuration_ReadWriteAccess_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) { - return cppu::acquire(static_cast< cppu::OWeakObject * >(new configmgr::read_write_access::Service(context))); + return cppu::acquire(new configmgr::read_write_access::Service(context)); } |