[Libreoffice-commits] core.git: 6 commits - framework/inc framework/source
Stephan Bergmann
sbergman at redhat.com
Thu Mar 20 01:48:50 PDT 2014
framework/inc/classes/propertysethelper.hxx | 8
framework/inc/tabwin/tabwinfactory.hxx | 4
framework/inc/uiconfiguration/imagemanager.hxx | 4
framework/source/fwi/classes/propertysethelper.cxx | 70 +---
framework/source/services/frame.cxx | 279 +++++++-----------
framework/source/services/tabwindowservice.cxx | 43 --
framework/source/tabwin/tabwinfactory.cxx | 13
framework/source/uiconfiguration/imagemanager.cxx | 6
framework/source/uiconfiguration/imagemanagerimpl.cxx | 52 +--
framework/source/uiconfiguration/imagemanagerimpl.hxx | 4
10 files changed, 196 insertions(+), 287 deletions(-)
New commits:
commit 6ac17129565dd9d98466a787b5f18a0f33dd5607
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 20 09:30:14 2014 +0100
Use SolarMutexGuard directly
Change-Id: I4533504d110dadbabfc737f7ca56b88afcc8ef44
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 293f456..577f23d 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -32,8 +32,6 @@
#include <dispatch/dispatchinformationprovider.hxx>
#include <classes/framecontainer.hxx>
#include <classes/propertysethelper.hxx>
-#include <threadhelp/guard.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <threadhelp/transactionguard.hxx>
#include <threadhelp/transactionbase.hxx>
#include <general.h>
@@ -115,8 +113,6 @@ enum EActiveState
iv) dispose object by calling XComponent::dispose()
After iv) all further requests are rejected by exceptions! (DisposedException)
- @base ThreadHelpBase
- help to guarantee correct initialized lock member at startup
@base TransactionBase
help to implement unbreakable interface calls
@base OBroadcastHelper
@@ -141,11 +137,9 @@ class Frame : // interfaces
public css::frame::XTitle ,
public css::frame::XTitleChangeBroadcaster ,
// base classes
- // Order is necessary for right initialization of this class!
- public ThreadHelpBase ,
public TransactionBase ,
private cppu::BaseMutex,
- public PropertySetHelper , // helper implements ThreadHelpbase, TransactionBase, XPropertySet, XPropertySetInfo
+ public PropertySetHelper , // helper implements TransactionBase, XPropertySet, XPropertySetInfo
public ::cppu::OWeakObject // helper implements XInterface, XWeak
{
public:
@@ -416,7 +410,7 @@ private:
// variables
-// -threadsafe by own read/write lock "m_aLock"
+// -threadsafe by SolarMutex
private:
@@ -453,31 +447,31 @@ protected:
inline css::uno::Reference< css::uno::XComponentContext > impl_getComponentContext()
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xContext;
}
inline OUString impl_getName()
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_sName;
}
inline css::uno::Reference< css::awt::XWindow > impl_getContainerWindow()
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xContainerWindow;
}
inline css::uno::Reference< css::frame::XDispatchProvider > impl_getDispatchHelper()
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xDispatchHelper;
}
inline css::uno::Reference< css::frame::XFramesSupplier > impl_getParent()
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xParent;
}
};
@@ -559,14 +553,13 @@ DEFINE_XTYPEPROVIDER_21 ( Frame
@onerror ASSERT in debug version or nothing in relaese version.
*//*-*****************************************************************************************************/
Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext )
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- , TransactionBase ( )
+ : TransactionBase ( )
, PropertySetHelper ( m_aMutex,
&m_aTransactionManager,
sal_False) // sal_False => dont release shared mutex on calling us!
// init member
, m_xContext ( xContext )
- , m_aListenerContainer ( m_aLock.getShareableOslMutex() )
+ , m_aListenerContainer ( m_aMutex )
, m_xParent ( )
, m_xContainerWindow ( )
, m_xComponentWindow ( )
@@ -693,10 +686,10 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
}
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY);
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
+ aReadLock.clear();
return LoadEnv::loadComponentFromURL(xThis, xContext, sURL, sTargetFrameName, nSearchFlags, lArguments);
}
@@ -728,9 +721,7 @@ css::uno::Reference< css::frame::XFrames > SAL_CALL Frame::getFrames() throw( cs
TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
// Return access to all child frames to caller.
// Ouer childframe container is implemented in helper class OFrames and used as a reference m_xFramesHelper!
return m_xFramesHelper;
@@ -757,9 +748,7 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::getActiveFrame() throw
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
// Return current active frame.
// This information is available on the container.
return m_aChildFrameContainer.getActive();
@@ -788,7 +777,7 @@ void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFra
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexResettableGuard aWriteLock;
// Copy necessary member for threadsafe access!
// m_aChildFrameContainer is threadsafe himself and he live if we live!!!
@@ -796,7 +785,7 @@ void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFra
css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive();
EActiveState eActiveState = m_eActiveState ;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Don't work, if "new" active frame is'nt different from current one!
@@ -820,10 +809,10 @@ void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFra
// ... reset state to ACTIVE and send right FrameActionEvent for focus lost.
if( eActiveState == E_FOCUS )
{
- aWriteLock.lock();
+ aWriteLock.reset();
eActiveState = E_ACTIVE ;
m_eActiveState = eActiveState;
- aWriteLock.unlock();
+ aWriteLock.clear();
implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING );
}
@@ -842,10 +831,10 @@ void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFra
// If this frame is active and has no active subframe anymore it is UI active too
if( eActiveState == E_ACTIVE )
{
- aWriteLock.lock();
+ aWriteLock.reset();
eActiveState = E_FOCUS ;
m_eActiveState = eActiveState;
- aWriteLock.unlock();
+ aWriteLock.clear();
implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_ACTIVATED );
}
}
@@ -901,7 +890,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >&
static_cast< css::frame::XFrame* >(this));
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexResettableGuard aWriteLock;
if ( m_xContainerWindow.is() )
throw css::uno::RuntimeException(
@@ -930,7 +919,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >&
// Release lock ... because we call some impl methods, which are threadsafe by himself.
// If we hold this lock - we will produce our own deadlock!
- aWriteLock.unlock();
+ aWriteLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
if (xLayoutManager.is())
@@ -942,9 +931,9 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >&
css::task::StatusIndicatorFactory::createWithFrame(xContext, xThis, sal_False/*DisableReschedule*/, sal_True/*AllowParentShow*/ );
// SAFE -> ----------------------------------
- aWriteLock.lock();
+ aWriteLock.reset();
m_xIndicatorFactoryHelper = xIndicatorFactory;
- aWriteLock.unlock();
+ aWriteLock.clear();
// <- SAFE ----------------------------------
// Start listening for events after setting it on helper class ...
@@ -981,9 +970,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getContainerWindow() th
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
return m_xContainerWindow;
}
@@ -1009,9 +996,9 @@ void SAL_CALL Frame::setCreator( const css::uno::Reference< css::frame::XFramesS
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexClearableGuard aWriteLock;
m_xParent = xCreator;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* } SAFE */
css::uno::Reference< css::frame::XDesktop > xIsDesktop( xCreator, css::uno::UNO_QUERY );
@@ -1035,9 +1022,7 @@ css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Frame::getCreator()
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
return m_xParent;
}
@@ -1054,10 +1039,8 @@ css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Frame::getCreator()
*//*-*****************************************************************************************************/
OUString SAL_CALL Frame::getName() throw( css::uno::RuntimeException, std::exception )
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_sName;
- /* } SAFE */
}
/*-****************************************************************************************************
@@ -1076,14 +1059,11 @@ OUString SAL_CALL Frame::getName() throw( css::uno::RuntimeException, std::excep
*//*-*****************************************************************************************************/
void SAL_CALL Frame::setName( const OUString& sName ) throw( css::uno::RuntimeException, std::exception )
{
- /* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
// Set new name ... but look for invalid special target names!
// They are not allowed to set.
if (TargetHelper::isValidNameForFrame(sName))
m_sName = sName;
- aWriteLock.unlock();
- /* } SAFE */
}
/*-****************************************************************************************************
@@ -1138,12 +1118,12 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr
// get threadsafe some necessary member which are necessary for following functionality
/* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexResettableGuard aReadLock;
css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY );
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
sal_Bool bIsTopFrame = m_bIsFrameTop;
sal_Bool bIsTopWindow = WindowHelper::isTopWindow(m_xContainerWindow);
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
@@ -1230,9 +1210,9 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const OUStr
// get threadsafe some necessary member which are necessary for following functionality
/* SAFE { */
- aReadLock.lock();
+ aReadLock.reset();
OUString sOwnName = m_sName;
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
@@ -1391,9 +1371,7 @@ sal_Bool SAL_CALL Frame::isTop() throw( css::uno::RuntimeException, std::excepti
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
// This information is set in setCreator().
// We are top, if ouer parent is a task or the desktop or if no parent exist!
return m_bIsFrameTop;
@@ -1421,7 +1399,7 @@ void SAL_CALL Frame::activate() throw( css::uno::RuntimeException, std::exceptio
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexResettableGuard aWriteLock;
// Copy necessary member and free the lock.
// It's not necessary for m_aChildFrameContainer ... because
@@ -1434,7 +1412,7 @@ void SAL_CALL Frame::activate() throw( css::uno::RuntimeException, std::exceptio
css::uno::Reference< css::awt::XWindow > xComponentWindow( m_xComponentWindow, css::uno::UNO_QUERY ) ;
EActiveState eState = m_eActiveState ;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
@@ -1442,10 +1420,10 @@ void SAL_CALL Frame::activate() throw( css::uno::RuntimeException, std::exceptio
if( eState == E_INACTIVE )
{
// ... do it then.
- aWriteLock.lock();
+ aWriteLock.reset();
eState = E_ACTIVE;
m_eActiveState = eState;
- aWriteLock.unlock();
+ aWriteLock.clear();
// Deactivate sibling path and forward activation to parent ... if any parent exist!
if( xParent.is() )
{
@@ -1484,10 +1462,10 @@ void SAL_CALL Frame::activate() throw( css::uno::RuntimeException, std::exceptio
// 3) I was active before or current activated. But if I have no active child => I will get the focus!
if ( eState == E_ACTIVE && !xActiveChild.is() )
{
- aWriteLock.lock();
+ aWriteLock.reset();
eState = E_FOCUS;
m_eActiveState = eState;
- aWriteLock.unlock();
+ aWriteLock.clear();
implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_ACTIVATED );
}
}
@@ -1514,7 +1492,7 @@ void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException, std::except
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexResettableGuard aWriteLock;
// Copy necessary member and free the lock.
css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive() ;
@@ -1522,7 +1500,7 @@ void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException, std::except
css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
EActiveState eState = m_eActiveState ;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Work only, if there something to do!
@@ -1541,10 +1519,10 @@ void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException, std::except
{
// Set new state INACTIVE(!) and send message to all listener.
// Don't set ACTIVE as new state. This frame is deactivated for next time - due to activate().
- aWriteLock.lock();
+ aWriteLock.reset();
eState = E_ACTIVE;
m_eActiveState = eState ;
- aWriteLock.unlock();
+ aWriteLock.clear();
implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING );
}
@@ -1553,10 +1531,10 @@ void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException, std::except
if( eState == E_ACTIVE )
{
// Set new state and send message to all listener.
- aWriteLock.lock();
+ aWriteLock.reset();
eState = E_INACTIVE;
m_eActiveState = eState ;
- aWriteLock.unlock();
+ aWriteLock.clear();
implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_DEACTIVATING );
}
@@ -1594,9 +1572,7 @@ sal_Bool SAL_CALL Frame::isActive() throw( css::uno::RuntimeException, std::exce
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
return (
( m_eActiveState == E_ACTIVE ) ||
( m_eActiveState == E_FOCUS )
@@ -1666,14 +1642,14 @@ sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::X
// Get threadsafe some copies of used members.
/* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow;
css::uno::Reference< css::frame::XController > xOldController = m_xController;
Window* pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow );
sal_Bool bHadFocus = pOwnWindow->HasChildPathFocus();
sal_Bool bWasConnected = m_bConnected;
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
@@ -1705,9 +1681,9 @@ sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::X
// Before we dispose this controller we should hide it inside this frame instance.
// We hold it alive for next calls by using xOldController!
/* SAFE {*/
- Guard aWriteLock( m_aLock );
+ SolarMutexClearableGuard aWriteLock;
m_xController = NULL;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* } SAFE */
css::uno::Reference< css::lang::XComponent > xDisposable( xOldController, css::uno::UNO_QUERY );
@@ -1735,9 +1711,9 @@ sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::X
)
{
/* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexClearableGuard aWriteLock;
m_xComponentWindow = NULL;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* } SAFE */
css::uno::Reference< css::lang::XComponent > xDisposable( xOldComponentWindow, css::uno::UNO_QUERY );
@@ -1758,12 +1734,12 @@ sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::X
// Now it's time to set the new component ...
// By the way - find out our new "load state" - means if we have a valid component inside.
/* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexResettableGuard aWriteLock;
m_xComponentWindow = xComponentWindow;
m_xController = xController ;
m_bConnected = (m_xComponentWindow.is() || m_xController.is());
sal_Bool bIsConnected = m_bConnected;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* } SAFE */
@@ -1793,9 +1769,9 @@ sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::X
implts_startWindowListening();
/* SAFE { */
- aWriteLock.lock();
+ aWriteLock.reset();
impl_checkMenuCloser();
- aWriteLock.unlock();
+ aWriteLock.clear();
/* } SAFE */
return sal_True;
@@ -1825,9 +1801,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getComponentWindow() th
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
return m_xComponentWindow;
}
@@ -1851,11 +1825,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getComponentWindow() th
*//*-*****************************************************************************************************/
css::uno::Reference< css::frame::XController > SAL_CALL Frame::getController() throw( css::uno::RuntimeException, std::exception )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
return m_xController;
}
@@ -1957,11 +1927,8 @@ void SAL_CALL Frame::close( sal_Bool bDeliverOwnership ) throw( css::util::Close
{
if (bDeliverOwnership)
{
- /* SAFE */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
m_bSelfClose = sal_True;
- aWriteLock.unlock();
- /* SAFE */
}
throw css::util::CloseVetoException("Frame in use for loading document ...",static_cast< ::cppu::OWeakObject*>(this));
@@ -1989,9 +1956,9 @@ void SAL_CALL Frame::close( sal_Bool bDeliverOwnership ) throw( css::util::Close
}
/* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexClearableGuard aWriteLock;
m_bIsHidden = sal_True;
- aWriteLock.unlock();
+ aWriteLock.clear();
/* } SAFE */
impl_checkMenuCloser();
@@ -2040,9 +2007,9 @@ OUString SAL_CALL Frame::getTitle()
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
// SAFE ->
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XTitle > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW);
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
return xTitle->getTitle();
@@ -2055,9 +2022,9 @@ void SAL_CALL Frame::setTitle( const OUString& sTitle )
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
// SAFE ->
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XTitle > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW);
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
xTitle->setTitle(sTitle);
@@ -2070,9 +2037,9 @@ void SAL_CALL Frame::addTitleChangeListener( const css::uno::Reference< css::fra
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
// SAFE ->
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW);
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
xTitle->addTitleChangeListener(xListener);
@@ -2085,9 +2052,9 @@ void SAL_CALL Frame::removeTitleChangeListener( const css::uno::Reference< css::
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
// SAFE ->
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW);
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
xTitle->removeTitleChangeListener(xListener);
@@ -2101,7 +2068,7 @@ css::uno::Reference<css::container::XNameContainer> SAL_CALL Frame::getUserDefin
css::uno::Reference<css::frame::XDispatchRecorderSupplier> SAL_CALL Frame::getDispatchRecorderSupplier() throw (css::uno::RuntimeException, std::exception)
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xDispatchRecorderSupplier;
}
@@ -2109,16 +2076,13 @@ void SAL_CALL Frame::setDispatchRecorderSupplier(const css::uno::Reference<css::
{
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE { */
- Guard aWriteLock( m_aLock );
- m_xDispatchRecorderSupplier.set(p);
- aWriteLock.unlock();
- /* } SAFE */
+ SolarMutexGuard g;
+ m_xDispatchRecorderSupplier.set(p);
}
css::uno::Reference<css::uno::XInterface> SAL_CALL Frame::getLayoutManager() throw (css::uno::RuntimeException, std::exception)
{
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xLayoutManager;
}
@@ -2126,11 +2090,8 @@ void SAL_CALL Frame::setLayoutManager(const css::uno::Reference<css::uno::XInter
{
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE { */
- Guard aWriteLock( m_aLock );
- m_xLayoutManager.set(p1, css::uno::UNO_QUERY);
- aWriteLock.unlock();
- /* } SAFE */
+ SolarMutexGuard g;
+ m_xLayoutManager.set(p1, css::uno::UNO_QUERY);
}
@@ -2138,9 +2099,9 @@ void SAL_CALL Frame::setLayoutManager(const css::uno::Reference<css::uno::XInter
void Frame::implts_forgetSubFrames()
{
// SAFE ->
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::container::XIndexAccess > xContainer(m_xFramesHelper, css::uno::UNO_QUERY_THROW);
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
sal_Int32 c = xContainer->getCount();
@@ -2162,12 +2123,9 @@ void Frame::implts_forgetSubFrames()
}
}
- // SAFE ->
- Guard aWriteLock(m_aLock);
+ SolarMutexGuard g;
m_xFramesHelper.clear(); // clear uno reference
m_aChildFrameContainer.clear(); // clear container content
- aWriteLock.unlock();
- // <- SAFE
}
/*-****************************************************************************************************
@@ -2376,13 +2334,13 @@ css::uno::Reference< css::task::XStatusIndicator > SAL_CALL Frame::createStatusI
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
// Make snapshot of necessary member and define default return value.
css::uno::Reference< css::task::XStatusIndicator > xExternal(m_xIndicatorInterception.get(), css::uno::UNO_QUERY);
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory = m_xIndicatorFactoryHelper;
- aReadLock.unlock();
+ aReadLock.clear();
/* UNSAFE AREA ----------------------------------------------------------------------------------------- */
// Was set from outside to intercept any progress activities!
@@ -2558,10 +2516,10 @@ void SAL_CALL Frame::focusGained( const css::awt::FocusEvent& aEvent ) throw( cs
TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
// Make snapshot of member!
css::uno::Reference< css::awt::XWindow > xComponentWindow = m_xComponentWindow;
- aReadLock.unlock();
+ aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
if( xComponentWindow.is() )
@@ -2594,10 +2552,10 @@ void SAL_CALL Frame::windowActivated( const css::lang::EventObject& aEvent ) thr
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
// Make snapshot of member!
EActiveState eState = m_eActiveState;
- aReadLock.unlock();
+ aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Activate the new active path from here to top.
if( eState == E_INACTIVE )
@@ -2618,13 +2576,13 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& aEvent ) t
TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY );
css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
EActiveState eActiveState = m_eActiveState ;
- aReadLock.unlock();
+ aReadLock.clear();
if( eActiveState != E_INACTIVE )
{
@@ -2683,9 +2641,9 @@ void SAL_CALL Frame::windowClosing( const css::lang::EventObject& ) throw( css::
*/
/* SAFE */
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
+ aReadLock.clear();
/* SAFE */
css::util::URL aURL;
@@ -2729,11 +2687,11 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno
static sal_Bool bFirstVisibleTask = sal_True;
/* SAFE { */
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::frame::XDesktop > xDesktopCheck( m_xParent, css::uno::UNO_QUERY );
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
m_bIsHidden = sal_False;
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
impl_checkMenuCloser();
@@ -2759,9 +2717,9 @@ void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno
void SAL_CALL Frame::windowHidden( const css::lang::EventObject& ) throw(css::uno::RuntimeException, std::exception)
{
/* SAFE { */
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
m_bIsHidden = sal_True;
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
impl_checkMenuCloser();
@@ -2792,14 +2750,14 @@ void SAL_CALL Frame::disposing( const css::lang::EventObject& aEvent ) throw( cs
TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexResettableGuard aWriteLock;
if( aEvent.Source == m_xContainerWindow )
{
// NECESSARY: Impl-method is threadsafe by himself!
- aWriteLock.unlock();
+ aWriteLock.clear();
implts_stopWindowListening();
- aWriteLock.lock();
+ aWriteLock.reset();
m_xContainerWindow = css::uno::Reference< css::awt::XWindow >();
}
}
@@ -2825,15 +2783,13 @@ void SAL_CALL Frame::disposing( const css::lang::EventObject& aEvent ) throw( cs
*//*-*************************************************************************************************************/
sal_Bool SAL_CALL Frame::isActionLocked() throw( css::uno::RuntimeException, std::exception )
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return( m_nExternalLockCount!=0);
}
void SAL_CALL Frame::addActionLock() throw( css::uno::RuntimeException, std::exception )
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
++m_nExternalLockCount;
}
@@ -2842,19 +2798,18 @@ void SAL_CALL Frame::removeActionLock() throw( css::uno::RuntimeException, std::
// Register no transaction here! Otherwhise we wait for ever inside possible
// implts_checkSuicide()/dispose() request ...
- /* SAFE AREA */{
- Guard aWriteLock( m_aLock );
+ {
+ SolarMutexGuard g;
SAL_WARN_IF( m_nExternalLockCount<=0, "fwk", "Frame::removeActionLock(): Frame isn't locked! Possible multithreading problem detected." );
--m_nExternalLockCount;
- }/* SAFE */
+ }
implts_checkSuicide();
}
void SAL_CALL Frame::setActionLocks( sal_Int16 nLock ) throw( css::uno::RuntimeException, std::exception )
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
// Attention: If somewhere called resetActionLocks() before and get e.g. 5 locks ...
// and tried to set these 5 ones here after his operations ...
// we can't ignore setted requests during these two calls!
@@ -2868,11 +2823,11 @@ sal_Int16 SAL_CALL Frame::resetActionLocks() throw( css::uno::RuntimeException,
// implts_checkSuicide()/dispose() request ...
sal_Int16 nCurrentLocks = 0;
- /* SAFE */{
- Guard aWriteLock( m_aLock );
+ {
+ SolarMutexGuard g;
nCurrentLocks = m_nExternalLockCount;
m_nExternalLockCount = 0;
- }/* SAFE */
+ }
// Attention:
// external lock count is 0 here every time ... but if
@@ -3173,10 +3128,10 @@ void Frame::implts_setIconOnWindow()
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
// Make snapshot of necessary members and release lock.
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow, css::uno::UNO_QUERY );
css::uno::Reference< css::frame::XController > xController ( m_xController , css::uno::UNO_QUERY );
- aReadLock.unlock();
+ aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
if( xContainerWindow.is() && xController.is() )
@@ -3270,14 +3225,14 @@ void Frame::implts_startWindowListening()
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
// Make snapshot of necessary member!
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ;
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener;
css::uno::Reference< css::awt::XWindowListener > xWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
css::uno::Reference< css::awt::XFocusListener > xFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
- aReadLock.unlock();
+ aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
if( xContainerWindow.is() )
@@ -3310,14 +3265,14 @@ void Frame::implts_stopWindowListening()
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
// Make snapshot of necessary member!
- Guard aReadLock( m_aLock );
+ SolarMutexClearableGuard aReadLock;
css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ;
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext ;
css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener;
css::uno::Reference< css::awt::XWindowListener > xWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
css::uno::Reference< css::awt::XFocusListener > xFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
- aReadLock.unlock();
+ aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
if( xContainerWindow.is() )
@@ -3358,12 +3313,12 @@ void Frame::implts_stopWindowListening()
void Frame::implts_checkSuicide()
{
/* SAFE */
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
// in case of lock==0 and safed state of previous close() request m_bSelfClose
// we must force close() again. Because we had disagreed with that before.
sal_Bool bSuicide = (m_nExternalLockCount==0 && m_bSelfClose);
m_bSelfClose = sal_False;
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
// force close and deliver owner ship to source of possible throwed veto exception
// Attention: Because this method isn't designed to throw such exception we must supress
@@ -3426,7 +3381,7 @@ void Frame::impl_setCloser( /*IN*/ const css::uno::Reference< css::frame::XFrame
void Frame::impl_checkMenuCloser()
{
/* SAFE { */
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
// only top frames, which are part of our desktop hierarchy, can
// do so! By the way - we need the desktop instance to have access
@@ -3436,7 +3391,7 @@ void Frame::impl_checkMenuCloser()
if ( !xDesktop.is() || !xTaskSupplier.is() )
return;
- aReadLock.unlock();
+ aReadLock.clear();
/* } SAFE */
// analyze the list of current open tasks
commit cfb4c8125ac87d5e5d80d685c8199f0165a4fcfa
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 20 09:26:07 2014 +0100
Use SolarMutexGuard directly
Change-Id: I58bb5ede9c59f16d556db3c1e2f254eeba1c8f7d
diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx
index ed22520..c24f976 100644
--- a/framework/source/services/tabwindowservice.cxx
+++ b/framework/source/services/tabwindowservice.cxx
@@ -18,7 +18,6 @@
*/
#include <classes/fwktabwindow.hxx>
-#include <threadhelp/guard.hxx>
#include <services.h>
#include <properties.h>
@@ -37,7 +36,6 @@
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <classes/propertysethelper.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
@@ -88,7 +86,6 @@ class TabWindowService : public css::lang::XTypeProvider
, public css::lang::XServiceInfo
, public css::awt::XSimpleTabController
, public css::lang::XComponent
- , public ThreadHelpBase
, public TransactionBase
, private cppu::BaseMutex
, public PropertySetHelper
@@ -208,14 +205,7 @@ DEFINE_XTYPEPROVIDER_6 ( TabWindowService ,
// constructor
TabWindowService::TabWindowService()
- // 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() )
- , TransactionBase ( )
+ : TransactionBase ( )
, PropertySetHelper ( m_aMutex,
&m_aTransactionManager ,
sal_False ) // sal_False => dont release shared mutex on calling us!
@@ -225,7 +215,7 @@ TabWindowService::TabWindowService()
, m_xTabWin ( )
, m_pTabWin ( NULL )
, m_lTabPageInfos ( )
- , m_lListener ( m_aLock.getShareableOslMutex())
+ , m_lListener ( m_aMutex )
, m_nPageIndexCounter ( 1 )
, m_nCurrentPageIndex ( 0 )
{
@@ -242,9 +232,7 @@ void TabWindowService::initProperties()
TabWindowService::~TabWindowService()
{
- // SAFE->
- Guard aGuard(m_aLock);
-
+ SolarMutexGuard g;
if (m_pTabWin)
m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) );
}
@@ -255,8 +243,7 @@ TabWindowService::~TabWindowService()
::sal_Int32 SAL_CALL TabWindowService::insertTab()
throw ( css::uno::RuntimeException, std::exception )
{
- // SAFE ->
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
::sal_Int32 nID = m_nPageIndexCounter++;
TTabPageInfo aInfo(nID);
@@ -273,8 +260,7 @@ void SAL_CALL TabWindowService::removeTab(::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException, std::exception )
{
- // SAFE ->
- Guard aGuard(m_aLock);
+ SolarMutexGuard g;
// throws suitable IndexOutOfBoundsException .-)
TTabPageInfoHash::iterator pIt = impl_getTabPageInfo (nID);
@@ -293,8 +279,7 @@ void SAL_CALL TabWindowService::setTabProps( ::sal_Int32
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException, std::exception )
{
- // SAFE ->
- Guard aGuard(m_aLock);
+ SolarMutexGuard g;
// throws suitable IndexOutOfBoundsException .-)
TTabPageInfoHash::iterator pIt = impl_getTabPageInfo (nID);
@@ -319,8 +304,7 @@ css::uno::Sequence< css::beans::NamedValue > SAL_CALL TabWindowService::getTabPr
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException, std::exception )
{
- // SAFE ->
- Guard aGuard(m_aLock);
+ SolarMutexGuard g;
// throws suitable IndexOutOfBoundsException .-)
TTabPageInfoHash::const_iterator pIt = impl_getTabPageInfo (nID);
@@ -336,8 +320,7 @@ void SAL_CALL TabWindowService::activateTab(::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException, std::exception )
{
- // SAFE ->
- Guard aGuard(m_aLock);
+ SolarMutexGuard g;
// throws suitable IndexOutOfBoundsException .-)
impl_checkTabIndex (nID);
@@ -354,8 +337,7 @@ void SAL_CALL TabWindowService::activateTab(::sal_Int32 nID)
::sal_Int32 SAL_CALL TabWindowService::getActiveTabID()
throw (css::uno::RuntimeException, std::exception)
{
- // SAFE->
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
return m_nCurrentPageIndex;
}
@@ -383,8 +365,7 @@ void SAL_CALL TabWindowService::removeTabListener(const css::uno::Reference< css
void SAL_CALL TabWindowService::dispose()
throw (css::uno::RuntimeException, std::exception)
{
- // SAFE->
- Guard aGuard(m_aLock);
+ SolarMutexGuard g;
css::uno::Reference< css::uno::XInterface > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
css::lang::EventObject aEvent(xThis);
commit 227e924baeeb6087d4c49b0dd46a46b092c39ff0
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 20 09:23:04 2014 +0100
Use SolarMutexGuard directly
(both users of PropertySetHelper use a SolarMutex-based ThreadHelpBase)
Change-Id: If542914bbf33a9e81f86d654498c2af04082f31d
diff --git a/framework/inc/classes/propertysethelper.hxx b/framework/inc/classes/propertysethelper.hxx
index a297628..d8baf70 100644
--- a/framework/inc/classes/propertysethelper.hxx
+++ b/framework/inc/classes/propertysethelper.hxx
@@ -70,7 +70,6 @@ class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet
// hold it weak ... otherwise this helper has to be "killed" explicitly .-)
css::uno::WeakReference< css::uno::XInterface > m_xBroadcaster;
- LockHelper& m_rLock;
TransactionManager& m_rTransactionManager;
@@ -80,11 +79,6 @@ class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet
/** initialize new instance of this helper.
*
- * @param pExternalLock
- * this helper must be used as a baseclass ...
- * but then it should synchronize its own calls
- * with the same lock then it's superclass uses.
- *
* @param pExternalTransactionManager
* this helper must be used as a baseclass ...
* but then it should synchronize its own calls
@@ -93,7 +87,7 @@ class FWI_DLLPUBLIC PropertySetHelper : public css::beans::XPropertySet
* @param bReleaseLockOnCall
* see member m_bReleaseLockOnCall
*/
- PropertySetHelper( LockHelper* pExternalLock ,
+ PropertySetHelper( osl::Mutex & mutex,
TransactionManager* pExternalTransactionManager ,
sal_Bool bReleaseLockOnCall );
diff --git a/framework/source/fwi/classes/propertysethelper.cxx b/framework/source/fwi/classes/propertysethelper.cxx
index 6e8cb07..636b5df 100644
--- a/framework/source/fwi/classes/propertysethelper.cxx
+++ b/framework/source/fwi/classes/propertysethelper.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <vcl/svapp.hxx>
+
#include <classes/propertysethelper.hxx>
#include <threadhelp/transactionguard.hxx>
#include <threadhelp/guard.hxx>
@@ -25,13 +29,12 @@ namespace framework{
-PropertySetHelper::PropertySetHelper( LockHelper* pExternalLock ,
+PropertySetHelper::PropertySetHelper( osl::Mutex & mutex,
TransactionManager* pExternalTransactionManager ,
sal_Bool bReleaseLockOnCall )
- : m_lSimpleChangeListener(pExternalLock->getShareableOslMutex())
- , m_lVetoChangeListener (pExternalLock->getShareableOslMutex())
+ : m_lSimpleChangeListener(mutex)
+ , m_lVetoChangeListener (mutex)
, m_bReleaseLockOnCall (bReleaseLockOnCall )
- , m_rLock (*pExternalLock )
, m_rTransactionManager (*pExternalTransactionManager )
{
}
@@ -46,11 +49,8 @@ void PropertySetHelper::impl_setPropertyChangeBroadcaster(const css::uno::Refere
{
TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
- // SAFE ->
- Guard aWriteLock(m_rLock);
+ SolarMutexGuard g;
m_xBroadcaster = xBroadcaster;
- aWriteLock.unlock();
- // <- SAFE
}
@@ -60,15 +60,13 @@ void SAL_CALL PropertySetHelper::impl_addPropertyInfo(const css::beans::Property
{
TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
- // SAFE ->
- Guard aWriteLock(m_rLock);
+ SolarMutexGuard g;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(aProperty.Name);
if (pIt != m_lProps.end())
throw css::beans::PropertyExistException();
m_lProps[aProperty.Name] = aProperty;
- // <- SAFE
}
@@ -78,15 +76,13 @@ void SAL_CALL PropertySetHelper::impl_removePropertyInfo(const OUString& sProper
{
TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
- // SAFE ->
- Guard aWriteLock(m_rLock);
+ SolarMutexGuard g;
PropertySetHelper::TPropInfoHash::iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
throw css::beans::UnknownPropertyException();
m_lProps.erase(pIt);
- // <- SAFE
}
@@ -99,8 +95,7 @@ void SAL_CALL PropertySetHelper::impl_disablePropertySet()
{
TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
- // SAFE ->
- Guard aWriteLock(m_rLock);
+ SolarMutexGuard g;
css::uno::Reference< css::uno::XInterface > xThis(static_cast< css::beans::XPropertySet* >(this), css::uno::UNO_QUERY);
css::lang::EventObject aEvent(xThis);
@@ -108,9 +103,6 @@ void SAL_CALL PropertySetHelper::impl_disablePropertySet()
m_lSimpleChangeListener.disposeAndClear(aEvent);
m_lVetoChangeListener.disposeAndClear(aEvent);
m_lProps.free();
-
- aWriteLock.unlock();
- // <- SAFE
}
@@ -193,7 +185,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue(const OUString& sProperty,
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
// SAFE ->
- Guard aWriteLock(m_rLock);
+ SolarMutexResettableGuard aWriteLock;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
@@ -204,7 +196,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue(const OUString& sProperty,
sal_Bool bLocked = sal_True;
if (m_bReleaseLockOnCall)
{
- aWriteLock.unlock();
+ aWriteLock.clear();
bLocked = sal_False;
// <- SAFE
}
@@ -214,7 +206,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue(const OUString& sProperty,
if (! bLocked)
{
// SAFE ->
- aWriteLock.lock();
+ aWriteLock.reset();
bLocked = sal_True;
}
@@ -232,7 +224,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue(const OUString& sProperty,
if (m_bReleaseLockOnCall)
{
- aWriteLock.unlock();
+ aWriteLock.clear();
bLocked = sal_False;
// <- SAFE
}
@@ -254,7 +246,7 @@ css::uno::Any SAL_CALL PropertySetHelper::getPropertyValue(const OUString& sProp
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
// SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexClearableGuard aReadLock;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
@@ -263,7 +255,7 @@ css::uno::Any SAL_CALL PropertySetHelper::getPropertyValue(const OUString& sProp
css::beans::Property aPropInfo = pIt->second;
if (m_bReleaseLockOnCall)
- aReadLock.unlock();
+ aReadLock.clear();
return impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
}
@@ -278,13 +270,13 @@ void SAL_CALL PropertySetHelper::addPropertyChangeListener(const OUString&
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
// SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexClearableGuard aReadLock;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
throw css::beans::UnknownPropertyException();
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
m_lSimpleChangeListener.addInterface(sProperty, xListener);
@@ -300,13 +292,13 @@ void SAL_CALL PropertySetHelper::removePropertyChangeListener(const OUString&
TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
// SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexClearableGuard aReadLock;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
throw css::beans::UnknownPropertyException();
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
m_lSimpleChangeListener.removeInterface(sProperty, xListener);
@@ -322,13 +314,13 @@ void SAL_CALL PropertySetHelper::addVetoableChangeListener(const OUString&
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
// SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexClearableGuard aReadLock;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
throw css::beans::UnknownPropertyException();
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
m_lVetoChangeListener.addInterface(sProperty, xListener);
@@ -344,13 +336,13 @@ void SAL_CALL PropertySetHelper::removeVetoableChangeListener(const OUString&
TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
// SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexClearableGuard aReadLock;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
if (pIt == m_lProps.end())
throw css::beans::UnknownPropertyException();
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
m_lVetoChangeListener.removeInterface(sProperty, xListener);
@@ -362,8 +354,7 @@ css::uno::Sequence< css::beans::Property > SAL_CALL PropertySetHelper::getProper
{
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
- // SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexGuard g;
sal_Int32 c = (sal_Int32)m_lProps.size();
css::uno::Sequence< css::beans::Property > lProps(c);
@@ -377,7 +368,6 @@ css::uno::Sequence< css::beans::Property > SAL_CALL PropertySetHelper::getProper
}
return lProps;
- // <- SAFE
}
@@ -387,15 +377,13 @@ css::beans::Property SAL_CALL PropertySetHelper::getPropertyByName(const OUStrin
{
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
- // SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexGuard g;
PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sName);
if (pIt == m_lProps.end())
throw css::beans::UnknownPropertyException();
return pIt->second;
- // <- SAFE
}
@@ -404,14 +392,12 @@ sal_Bool SAL_CALL PropertySetHelper::hasPropertyByName(const OUString& sName)
{
TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
- // SAFE ->
- Guard aReadLock(m_rLock);
+ SolarMutexGuard g;
PropertySetHelper::TPropInfoHash::iterator pIt = m_lProps.find(sName);
sal_Bool bExist = (pIt != m_lProps.end());
return bExist;
- // <- SAFE
}
} // namespace framework
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 4d571e3..293f456 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/sequenceashashmap.hxx>
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/factory.hxx>
@@ -143,6 +144,7 @@ class Frame : // interfaces
// Order is necessary for right initialization of this class!
public ThreadHelpBase ,
public TransactionBase ,
+ private cppu::BaseMutex,
public PropertySetHelper , // helper implements ThreadHelpbase, TransactionBase, XPropertySet, XPropertySetInfo
public ::cppu::OWeakObject // helper implements XInterface, XWeak
{
@@ -559,7 +561,7 @@ DEFINE_XTYPEPROVIDER_21 ( Frame
Frame::Frame( const css::uno::Reference< css::uno::XComponentContext >& xContext )
: ThreadHelpBase ( &Application::GetSolarMutex() )
, TransactionBase ( )
- , PropertySetHelper ( &m_aLock,
+ , PropertySetHelper ( m_aMutex,
&m_aTransactionManager,
sal_False) // sal_False => dont release shared mutex on calling us!
// init member
diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx
index 65d7110..ed22520 100644
--- a/framework/source/services/tabwindowservice.cxx
+++ b/framework/source/services/tabwindowservice.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -89,6 +90,7 @@ class TabWindowService : public css::lang::XTypeProvider
, public css::lang::XComponent
, public ThreadHelpBase
, public TransactionBase
+ , private cppu::BaseMutex
, public PropertySetHelper
, public ::cppu::OWeakObject
{
@@ -214,7 +216,7 @@ TabWindowService::TabWindowService()
// baseclasses and then members. And we need the mutex for other baseclasses !!!
: ThreadHelpBase ( &Application::GetSolarMutex() )
, TransactionBase ( )
- , PropertySetHelper ( &m_aLock ,
+ , PropertySetHelper ( m_aMutex,
&m_aTransactionManager ,
sal_False ) // sal_False => dont release shared mutex on calling us!
, OWeakObject ( )
commit 6771778d2e5423c7b2d3d6f81669b5d0d0925c63
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 20 09:11:19 2014 +0100
Use SolarMutexGuard directly
Change-Id: If09abe4dd6191efa5f92bf3af7cc6e119f401ab8
diff --git a/framework/inc/tabwin/tabwinfactory.hxx b/framework/inc/tabwin/tabwinfactory.hxx
index 5f40b27..25f63f4 100644
--- a/framework/inc/tabwin/tabwinfactory.hxx
+++ b/framework/inc/tabwin/tabwinfactory.hxx
@@ -21,7 +21,6 @@
#define INCLUDED_FRAMEWORK_INC_TABWIN_TABWINFACTORY_HXX
#include <stdtypes.h>
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
@@ -41,8 +40,7 @@
namespace framework
{
-class TabWinFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>
+class TabWinFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>
{
public:
TabWinFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
diff --git a/framework/source/tabwin/tabwinfactory.cxx b/framework/source/tabwin/tabwinfactory.cxx
index 373a48d..41f7246 100644
--- a/framework/source/tabwin/tabwinfactory.cxx
+++ b/framework/source/tabwin/tabwinfactory.cxx
@@ -20,8 +20,6 @@
#include <tabwin/tabwinfactory.hxx>
#include <tabwin/tabwindow.hxx>
-#include <threadhelp/guard.hxx>
-
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/awt/Toolkit.hpp>
@@ -55,8 +53,7 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( TabWinFactory
DEFINE_INIT_SERVICE ( TabWinFactory, {} )
TabWinFactory::TabWinFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
- ThreadHelpBase( &Application::GetSolarMutex() )
- , m_xContext( xContext )
+ m_xContext( xContext )
{
}
@@ -80,10 +77,10 @@ throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
const OUString aTopWindowArgName( "TopWindow");
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- Guard aLock( m_aLock );
+ SolarMutexResettableGuard aLock;
css::uno::Reference< css::awt::XToolkit2 > xToolkit = m_xToolkit;
css::uno::Reference< css::uno::XComponentContext > xContext( m_xContext );
- aLock.unlock();
+ aLock.clear();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
css::uno::Reference< css::uno::XInterface > xReturn;
@@ -103,9 +100,9 @@ throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
{
xToolkit = css::awt::Toolkit::create( xContext );
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- aLock.lock();
+ aLock.reset();
m_xToolkit = xToolkit;
- aLock.unlock();
+ aLock.clear();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
}
commit 67f378565044355d50aab69b05799adb7c3027bc
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 20 09:09:14 2014 +0100
Remove unused ThreadHelpBase base
Change-Id: I0e15184071fc2c1cb231ead98210d4a1654208e7
diff --git a/framework/inc/uiconfiguration/imagemanager.hxx b/framework/inc/uiconfiguration/imagemanager.hxx
index 67193fe..baf17ee 100644
--- a/framework/inc/uiconfiguration/imagemanager.hxx
+++ b/framework/inc/uiconfiguration/imagemanager.hxx
@@ -24,7 +24,6 @@
#include <boost/unordered_map.hpp>
#include <memory>
-#include <threadhelp/threadhelpbase.hxx>
#include <stdtypes.h>
#include <uiconfiguration/imagetype.hxx>
@@ -51,8 +50,7 @@
namespace framework
{
class ImageManagerImpl;
- class ImageManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
- public ::cppu::WeakImplHelper2< ::com::sun::star::ui::XImageManager, css::lang::XServiceInfo>
+ class ImageManager : public ::cppu::WeakImplHelper2< ::com::sun::star::ui::XImageManager, css::lang::XServiceInfo>
{
public:
ImageManager( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index 737dd8d..cd912d9 100644
--- a/framework/source/uiconfiguration/imagemanager.cxx
+++ b/framework/source/uiconfiguration/imagemanager.cxx
@@ -19,7 +19,6 @@
#include <uiconfiguration/imagemanager.hxx>
-#include <threadhelp/guard.hxx>
#include <xml/imagesconfiguration.hxx>
#include <uiconfiguration/graphicnameaccess.hxx>
#include "imagemanagerimpl.hxx"
@@ -60,8 +59,7 @@ namespace framework
{
ImageManager::ImageManager( const uno::Reference< uno::XComponentContext >& rxContext ) :
- ThreadHelpBase( &Application::GetSolarMutex() )
- , m_pImpl( new ImageManagerImpl(rxContext, this, false) )
+ m_pImpl( new ImageManagerImpl(rxContext, this, false) )
{
}
commit 94f8a0e60b7bc5c1176eafe9a36c3f3466bd1408
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 20 09:08:10 2014 +0100
Use SolarMutexGuard directly
Change-Id: I4b245dd68bf032a1d74fb16b910dc952fd761781
diff --git a/framework/source/uiconfiguration/imagemanager.cxx b/framework/source/uiconfiguration/imagemanager.cxx
index 5fc2d30..737dd8d 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 5c6d2a6..b8aead1 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 b8888d2..2f36fd1 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];
More information about the Libreoffice-commits
mailing list