From 8030fe25724bd995a6902610614ba05ed6cfb643 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 18 Mar 2014 14:42:27 +0100 Subject: Use SolarMutexGuard directly Change-Id: Ie13cf612b2f9b15698a84d35d420b0b7c0009e1b --- framework/inc/helper/ocomponentenumeration.hxx | 7 ++----- framework/source/helper/ocomponentenumeration.cxx | 21 ++++----------------- 2 files changed, 6 insertions(+), 22 deletions(-) (limited to 'framework') diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx index 1b397f050578..710a3820150d 100644 --- a/framework/inc/helper/ocomponentenumeration.hxx +++ b/framework/inc/helper/ocomponentenumeration.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_FRAMEWORK_INC_HELPER_OCOMPONENTENUMERATION_HXX #define INCLUDED_FRAMEWORK_INC_HELPER_OCOMPONENTENUMERATION_HXX -#include #include #include #include @@ -45,15 +44,13 @@ namespace framework{ XEventListener XEnumeration - @base ThreadHelpBase - OWeakObject + @base OWeakObject @devstatus ready to use @threadsafe yes *//*-*************************************************************************************************************/ -class OComponentEnumeration : public ThreadHelpBase , - public ::cppu::WeakImplHelper2< ::com::sun::star::container::XEnumeration,::com::sun::star::lang::XEventListener > +class OComponentEnumeration : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XEnumeration,::com::sun::star::lang::XEventListener > { // public methods diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx index e7e1eaa86add..2f3057c8d137 100644 --- a/framework/source/helper/ocomponentenumeration.cxx +++ b/framework/source/helper/ocomponentenumeration.cxx @@ -19,8 +19,6 @@ #include -#include - #include namespace framework{ @@ -36,15 +34,7 @@ using namespace ::rtl ; // constructor OComponentEnumeration::OComponentEnumeration( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) - // Init baseclasses first - // Attention: - // Don't change order of initialization! - // ThreadHelpBase is a struct with a mutex as member. We can't use a mutex as member, while - // we must garant right initialization and a valid value of this! First initialize - // baseclasses and then members. And we need the mutex for other baseclasses !!! - : ThreadHelpBase ( &Application::GetSolarMutex() ) - // Init member - , m_nPosition ( 0 ) // 0 is the first position for a valid list and the right value for an invalid list to! + : m_nPosition ( 0 ) // 0 is the first position for a valid list and the right value for an invalid list to! , m_seqComponents ( seqComponents ) { // Safe impossible states @@ -65,8 +55,7 @@ OComponentEnumeration::~OComponentEnumeration() // XEventListener void SAL_CALL OComponentEnumeration::disposing( const EventObject& aEvent ) throw( RuntimeException, std::exception ) { - // Ready for multithreading - Guard aGuard( m_aLock ); + SolarMutexGuard g; // Safe impossible cases // This method is not specified for all incoming parameters. @@ -81,8 +70,7 @@ void SAL_CALL OComponentEnumeration::disposing( const EventObject& aEvent ) thro // XEnumeration sal_Bool SAL_CALL OComponentEnumeration::hasMoreElements() throw( RuntimeException, std::exception ) { - // Ready for multithreading - Guard aGuard( m_aLock ); + SolarMutexGuard g; // First position in a valid list is 0. // => The last one is getLength() - 1! @@ -98,8 +86,7 @@ Any SAL_CALL OComponentEnumeration::nextElement() throw( NoSuchElementExcepti WrappedTargetException , RuntimeException, std::exception ) { - // Ready for multithreading - Guard aGuard( m_aLock ); + SolarMutexGuard g; // If we have no elements or end of enumeration is arrived ... if ( hasMoreElements() == sal_False ) -- cgit