diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-03-20 09:08:10 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-03-20 09:48:22 +0100 |
commit | 94f8a0e60b7bc5c1176eafe9a36c3f3466bd1408 (patch) | |
tree | 6ec6dd5572908dc4bf7ce9d6427d7f2975c04cbd /framework/source/uiconfiguration | |
parent | bbdf832d48cb7f89ee9d6e355841a31c672aadd9 (diff) |
Use SolarMutexGuard directly
Change-Id: I4b245dd68bf032a1d74fb16b910dc952fd761781
Diffstat (limited to 'framework/source/uiconfiguration')
-rw-r--r-- | framework/source/uiconfiguration/imagemanager.cxx | 2 | ||||
-rw-r--r-- | framework/source/uiconfiguration/imagemanagerimpl.cxx | 52 | ||||
-rw-r--r-- | framework/source/uiconfiguration/imagemanagerimpl.hxx | 4 |
3 files changed, 28 insertions, 30 deletions
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx index 5fc2d3020a29..737dd8d5ea54 100644 --- a/framework/source/uiconfiguration/imagemanager.cxx +++ b/framework/source/uiconfiguration/imagemanager.cxx @@ -91,7 +91,7 @@ void SAL_CALL ImageManager::removeEventListener( const uno::Reference< XEventLis void ImageManager::setStorage( const uno::Reference< XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException) { - Guard aLock( m_pImpl->m_aLock ); + SolarMutexGuard g; m_pImpl->m_xUserConfigStorage = Storage; m_pImpl->implts_initialize(); diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 5c6d2a612c79..b8aead1d7953 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -19,7 +19,6 @@ #include <imagemanagerimpl.hxx> -#include <threadhelp/guard.hxx> #include <xml/imagesconfiguration.hxx> #include <uiconfiguration/graphicnameaccess.hxx> #include <services.h> @@ -421,7 +420,7 @@ static sal_Int16 implts_convertImageTypeToIndex( sal_Int16 nImageType ) ImageList* ImageManagerImpl::implts_getUserImageList( ImageType nImageType ) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( !m_pUserImageList[nImageType] ) implts_loadUserImages( nImageType, m_xUserImageStorage, m_xUserBitmapsStorage ); @@ -468,7 +467,7 @@ sal_Bool ImageManagerImpl::implts_loadUserImages( const uno::Reference< XStorage >& xUserImageStorage, const uno::Reference< XStorage >& xUserBitmapsStorage ) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( xUserImageStorage.is() && xUserBitmapsStorage.is() ) { @@ -548,7 +547,7 @@ sal_Bool ImageManagerImpl::implts_storeUserImages( const uno::Reference< XStorage >& xUserImageStorage, const uno::Reference< XStorage >& xUserBitmapsStorage ) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( m_bModified ) { @@ -650,7 +649,7 @@ sal_Bool ImageManagerImpl::implts_storeUserImages( const rtl::Reference< GlobalImageList >& ImageManagerImpl::implts_getGlobalImageList() { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( !m_pGlobalImageList.is() ) m_pGlobalImageList = getGlobalImageList( m_xContext ); @@ -659,7 +658,7 @@ const rtl::Reference< GlobalImageList >& ImageManagerImpl::implts_getGlobalImage CmdImageList* ImageManagerImpl::implts_getDefaultImageList() { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( !m_pDefaultImageList ) m_pDefaultImageList = new CmdImageList( m_xContext, m_aModuleIdentifier ); @@ -668,13 +667,12 @@ CmdImageList* ImageManagerImpl::implts_getDefaultImageList() } ImageManagerImpl::ImageManagerImpl( const uno::Reference< uno::XComponentContext >& rxContext,::cppu::OWeakObject* pOwner,bool _bUseGlobal ) : - ThreadHelpBase( &Application::GetSolarMutex() ) - , m_xContext( rxContext ) + m_xContext( rxContext ) , m_pOwner(pOwner) , m_pDefaultImageList( 0 ) , m_aXMLPostfix( ".xml" ) , m_aResourceString( ModuleImageList ) - , m_aListenerContainer( m_aLock.getShareableOslMutex() ) + , m_aListenerContainer( m_mutex ) , m_bUseGlobal(_bUseGlobal) , m_bReadOnly( true ) , m_bInitialized( false ) @@ -701,7 +699,7 @@ void ImageManagerImpl::dispose() m_aListenerContainer.disposeAndClear( aEvent ); { - Guard aGuard( m_aLock ); + SolarMutexGuard g; m_xUserConfigStorage.clear(); m_xUserImageStorage.clear(); m_xUserRootCommit.clear(); @@ -723,7 +721,7 @@ void ImageManagerImpl::dispose() void ImageManagerImpl::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { { - Guard aGuard( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -742,7 +740,7 @@ void ImageManagerImpl::removeEventListener( const uno::Reference< XEventListener // XInitialization void ImageManagerImpl::initialize( const Sequence< Any >& aArguments ) { - Guard aLock( m_aLock ); + SolarMutexGuard g; if ( !m_bInitialized ) { @@ -787,7 +785,7 @@ void ImageManagerImpl::initialize( const Sequence< Any >& aArguments ) void ImageManagerImpl::reset() throw (::com::sun::star::uno::RuntimeException) { - Guard aLock( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -817,7 +815,7 @@ throw (::com::sun::star::uno::RuntimeException) Sequence< OUString > ImageManagerImpl::getAllImageNames( ::sal_Int16 nImageType ) throw (::com::sun::star::uno::RuntimeException) { - Guard aLock( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -862,7 +860,7 @@ throw (::com::sun::star::uno::RuntimeException) ::sal_Bool ImageManagerImpl::hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - Guard aLock( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -895,7 +893,7 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages( const Sequence< OUString >& aCommandURLSequence ) throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ) { - Guard aLock( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -950,7 +948,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException, CmdToXGraphicNameAccess* pReplacedImages( 0 ); { - Guard aLock( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -1033,7 +1031,7 @@ throw ( ::com::sun::star::lang::IllegalArgumentException, CmdToXGraphicNameAccess* pReplacedImages( 0 ); { - Guard aLock( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -1143,7 +1141,7 @@ void ImageManagerImpl::reload() throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ) { - Guard aGuard( m_aLock ); + SolarMutexClearableGuard aGuard; if ( m_bDisposed ) throw DisposedException(); @@ -1245,7 +1243,7 @@ throw ( ::com::sun::star::uno::Exception, ++pIter; } - aGuard.unlock(); + aGuard.clear(); // Now notify our listeners. Unlock mutex to prevent deadlocks uno::Reference< uno::XInterface > xOwner(static_cast< OWeakObject* >(m_pOwner)); @@ -1284,7 +1282,7 @@ throw ( ::com::sun::star::uno::Exception, implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove ); } - aGuard.lock(); + aGuard.clear(); } } } @@ -1295,7 +1293,7 @@ void ImageManagerImpl::store() ::com::sun::star::uno::RuntimeException, std::exception) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( m_bDisposed ) throw DisposedException(); @@ -1330,7 +1328,7 @@ void ImageManagerImpl::storeToStorage( const uno::Reference< XStorage >& Storage ::com::sun::star::uno::RuntimeException, std::exception) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; if ( m_bDisposed ) throw DisposedException(); @@ -1361,13 +1359,13 @@ void ImageManagerImpl::storeToStorage( const uno::Reference< XStorage >& Storage sal_Bool ImageManagerImpl::isModified() throw (::com::sun::star::uno::RuntimeException) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; return m_bModified; } sal_Bool ImageManagerImpl::isReadOnly() throw (::com::sun::star::uno::RuntimeException) { - Guard aGuard( m_aLock ); + SolarMutexGuard g; return m_bReadOnly; } // XUIConfiguration @@ -1375,7 +1373,7 @@ void ImageManagerImpl::addConfigurationListener( const uno::Reference< ::com::su throw (::com::sun::star::uno::RuntimeException) { { - Guard aGuard( m_aLock ); + SolarMutexGuard g; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( m_bDisposed ) @@ -1426,7 +1424,7 @@ void ImageManagerImpl::implts_notifyContainerListener( const ConfigurationEvent& } void ImageManagerImpl::clear() { - Guard aGuard( m_aLock ); + SolarMutexGuard g; for ( sal_Int32 n = 0; n < ImageType_COUNT; n++ ) { diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx b/framework/source/uiconfiguration/imagemanagerimpl.hxx index b8888d2a0b8e..2f36fd125af8 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.hxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx @@ -27,7 +27,6 @@ #include <list> #include <boost/unordered_map.hpp> -#include <threadhelp/threadhelpbase.hxx> #include <macros/generic.hxx> #include <macros/xinterface.hxx> #include <macros/xtypeprovider.hxx> @@ -103,7 +102,7 @@ namespace framework oslInterlockedCount m_nRefCount; }; - class ImageManagerImpl : public ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses. + class ImageManagerImpl { public: ImageManagerImpl(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext @@ -189,6 +188,7 @@ namespace framework OUString m_aXMLPostfix; OUString m_aModuleIdentifier; OUString m_aResourceString; + osl::Mutex m_mutex; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener ImageList* m_pUserImageList[ImageType_COUNT]; bool m_bUserImageListModified[ImageType_COUNT]; |