summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-20 10:08:30 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-20 10:49:39 +0100
commitda9aaab596ef4cd24f43902a047332971c92ffb2 (patch)
treea05b22d58eb3e3fbabaa710728fff9f5e5e163b6
parent306859babd5a997a1e5d50e7791e8e5852a7ea2e (diff)
Use an osl::Mutex directly
Change-Id: Ia0a0dfae4390ad8cd74520396ecfbd6ac03a5d6f
-rw-r--r--framework/inc/uifactory/factoryconfiguration.hxx3
-rw-r--r--framework/source/uifactory/factoryconfiguration.cxx33
2 files changed, 12 insertions, 24 deletions
diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx
index 6f3c8ed56af8..4d7dc3dd2954 100644
--- a/framework/inc/uifactory/factoryconfiguration.hxx
+++ b/framework/inc/uifactory/factoryconfiguration.hxx
@@ -19,7 +19,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_FACTORYCONFIGURATION_HXX
#define INCLUDED_FRAMEWORK_INC_UIFACTORY_FACTORYCONFIGURATION_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
@@ -46,7 +45,6 @@ namespace framework
// Configuration access class for PopupMenuControllerFactory implementation
class ConfigurationAccess_ControllerFactory : // interfaces
- private ThreadHelpBase,
public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
{
public:
@@ -91,6 +89,7 @@ private:
sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, OUString& aCommand, OUString& aModule, OUString& aServiceSpecifier,OUString& aValue ) const;
+ mutable osl::Mutex m_mutex;
OUString m_aPropCommand;
OUString m_aPropModule;
OUString m_aPropController;
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
index 5320caaf52da..0b2c2b1be14d 100644
--- a/framework/source/uifactory/factoryconfiguration.cxx
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -18,7 +18,6 @@
*/
#include "uifactory/factoryconfiguration.hxx"
-#include <threadhelp/guard.hxx>
#include "services.h"
#include "helper/mischelper.hxx"
@@ -60,7 +59,6 @@ OUString getHashKeyFromStrings( const OUString& aCommandURL, const OUString& aMo
// XInterface, XTypeProvider
ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( const Reference< XComponentContext >& rxContext, const OUString& _sRoot,bool _bAskValue ) :
- ThreadHelpBase(),
m_aPropCommand( "Command" ),
m_aPropModule( "Module" ),
m_aPropController( "Controller" ),
@@ -74,8 +72,7 @@ ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( co
ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory()
{
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
if ( xContainer.is() )
@@ -84,8 +81,7 @@ ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory()
OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( const OUString& rCommandURL, const OUString& rModule ) const
{
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
if ( pIter != m_aMenuControllerMap.end() )
@@ -103,8 +99,7 @@ OUString ConfigurationAccess_ControllerFactory::getServiceFromCommandModule( con
}
OUString ConfigurationAccess_ControllerFactory::getValueFromCommandModule( const OUString& rCommandURL, const OUString& rModule ) const
{
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
MenuControllerMap::const_iterator pIter = m_aMenuControllerMap.find( getHashKeyFromStrings( rCommandURL, rModule ));
@@ -128,8 +123,7 @@ void ConfigurationAccess_ControllerFactory::addServiceToCommandModule(
const OUString& rModule,
const OUString& rServiceSpecifier )
{
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
m_aMenuControllerMap.insert( MenuControllerMap::value_type( aHashKey,ControllerInfo(rServiceSpecifier,OUString()) ));
@@ -139,8 +133,7 @@ void ConfigurationAccess_ControllerFactory::removeServiceFromCommandModule(
const OUString& rCommandURL,
const OUString& rModule )
{
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
OUString aHashKey = getHashKeyFromStrings( rCommandURL, rModule );
m_aMenuControllerMap.erase( aHashKey );
@@ -154,8 +147,7 @@ void SAL_CALL ConfigurationAccess_ControllerFactory::elementInserted( const Cont
OUString aService;
OUString aValue;
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
{
@@ -175,8 +167,7 @@ void SAL_CALL ConfigurationAccess_ControllerFactory::elementRemoved ( const Cont
OUString aService;
OUString aValue;
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
if ( impl_getElementProps( aEvent.Element, aCommand, aModule, aService, aValue ))
{
@@ -195,16 +186,15 @@ void SAL_CALL ConfigurationAccess_ControllerFactory::elementReplaced( const Cont
// lang.XEventListener
void SAL_CALL ConfigurationAccess_ControllerFactory::disposing( const EventObject& ) throw(RuntimeException, std::exception)
{
- // SAFE
// remove our reference to the config access
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
m_xConfigAccess.clear();
}
void ConfigurationAccess_ControllerFactory::readConfigurationData()
{
// SAFE
- Guard aLock( m_aLock );
+ osl::ClearableMutexGuard aLock( m_mutex );
if ( !m_bConfigAccessInitialized )
{
@@ -233,7 +223,7 @@ void ConfigurationAccess_ControllerFactory::readConfigurationData()
uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
// UNSAFE
- aLock.unlock();
+ aLock.clear();
if ( xContainer.is() )
{
@@ -245,8 +235,7 @@ void ConfigurationAccess_ControllerFactory::readConfigurationData()
void ConfigurationAccess_ControllerFactory::updateConfigurationData()
{
- // SAFE
- Guard aLock( m_aLock );
+ osl::MutexGuard g(m_mutex);
if ( m_xConfigAccess.is() )
{
Sequence< OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames();