summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-18 09:34:52 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-18 09:43:18 +0100
commit31052b36be1dbf39263ecf23496a5c041a805884 (patch)
tree3a6daafd71e185807c3e21829c94929c3d891580
parentc63f42e26ac61ef776fc7aa125d695f742358dc4 (diff)
Use SolarMutexGuard directly
Change-Id: I2ae1a43862754030f88df033551c93fdbeeab14a
-rw-r--r--framework/inc/dispatch/popupmenudispatcher.hxx11
-rw-r--r--framework/source/dispatch/popupmenudispatcher.cxx33
2 files changed, 13 insertions, 31 deletions
diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx
index 8b58855574e5..4a0ed092a5af 100644
--- a/framework/inc/dispatch/popupmenudispatcher.hxx
+++ b/framework/inc/dispatch/popupmenudispatcher.hxx
@@ -23,7 +23,6 @@
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <general.h>
#include <stdtypes.h>
@@ -69,16 +68,11 @@ typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< OUString ,
XLoadEventListener
XFrameActionListener
XEventListener
- @base ThreadHelpBase
- OWeakObject
+ @base OWeakObject
@devstatus ready to use
*//*-*************************************************************************************************************/
-class PopupMenuDispatcher : // baseclasses
- // Order is necessary for right initialization!
- public ThreadHelpBase ,
- // interfaces
- public ::cppu::WeakImplHelper5<
+class PopupMenuDispatcher : public ::cppu::WeakImplHelper5<
css::lang::XServiceInfo,
css::frame::XDispatchProvider,
css::frame::XDispatch,
@@ -142,6 +136,7 @@ class PopupMenuDispatcher : // baseclasses
css::uno::Reference< css::container::XNameAccess > m_xPopupCtrlQuery ; /// reference to query for popup controller
css::uno::Reference< css::uri::XUriReferenceFactory > m_xUriRefFactory ; /// reference to the uri reference factory
css::uno::Reference< css::uno::XComponentContext > m_xContext ; /// factory shared with our owner to create new services!
+ osl::Mutex m_mutex;
IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs
sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls.
sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index 3a91779f6bd9..1f29b10ff362 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -21,7 +21,6 @@
#include <general.h>
#include <framework/menuconfiguration.hxx>
#include <framework/addonmenu.hxx>
-#include <threadhelp/guard.hxx>
#include <services.h>
#include <properties.h>
@@ -60,11 +59,8 @@ using namespace ::rtl ;
PopupMenuDispatcher::PopupMenuDispatcher(
const uno::Reference< XComponentContext >& xContext )
- // Init baseclasses first
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- // Init member
- , m_xContext ( xContext )
- , m_aListenerContainer ( m_aLock.getShareableOslMutex() )
+ : m_xContext ( xContext )
+ , m_aListenerContainer ( m_mutex )
, m_bAlreadyDisposed ( sal_False )
, m_bActivateListener ( sal_False )
{
@@ -147,9 +143,7 @@ throw( css::uno::Exception, css::uno::RuntimeException, std::exception)
{
css::uno::Reference< css::frame::XFrame > xFrame;
- /* SAFE { */
- Guard aWriteLock(m_aLock);
-
+ SolarMutexGuard g;
for (int a=0; a<lArguments.getLength(); ++a)
{
if (a==0)
@@ -163,9 +157,6 @@ throw( css::uno::Exception, css::uno::RuntimeException, std::exception)
xFrame->addFrameActionListener( xFrameActionListener );
}
}
-
- aWriteLock.unlock();
- /* } SAFE */
}
css::uno::Reference< css::frame::XDispatch >
@@ -180,13 +171,13 @@ throw( css::uno::RuntimeException, std::exception )
if ( rURL.Complete.startsWith( "vnd.sun.star.popup:" ) )
{
// --- SAFE ---
- Guard aGuard( m_aLock );
+ SolarMutexClearableGuard aGuard;
impl_RetrievePopupControllerQuery();
impl_CreateUriRefFactory();
css::uno::Reference< css::container::XNameAccess > xPopupCtrlQuery( m_xPopupCtrlQuery );
css::uno::Reference< css::uri::XUriReferenceFactory > xUriRefFactory( m_xUriRefFactory );
- aGuard.unlock();
+ aGuard.clear();
// --- SAFE ---
if ( xPopupCtrlQuery.is() )
@@ -214,7 +205,7 @@ throw( css::uno::RuntimeException, std::exception )
// Find popup menu controller using the base URL
xPopupCtrlQuery->getByName( aBaseURL ) >>= xDispatchProvider;
- aGuard.unlock();
+ aGuard.clear();
// Ask popup menu dispatch provider for dispatch object
if ( xDispatchProvider.is() )
@@ -258,8 +249,7 @@ void SAL_CALL PopupMenuDispatcher::addStatusListener( const uno::Reference< XSta
const URL& aURL )
throw( RuntimeException, std::exception )
{
- // Ready for multithreading
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
// Safe impossible cases
// Add listener to container.
m_aListenerContainer.addInterface( aURL.Complete, xControl );
@@ -269,8 +259,7 @@ void SAL_CALL PopupMenuDispatcher::removeStatusListener( const uno::Reference< X
const URL& aURL )
throw( RuntimeException, std::exception )
{
- // Ready for multithreading
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
// Safe impossible cases
// Add listener to container.
m_aListenerContainer.removeInterface( aURL.Complete, xControl );
@@ -279,8 +268,7 @@ throw( RuntimeException, std::exception )
void SAL_CALL PopupMenuDispatcher::frameAction( const FrameActionEvent& aEvent )
throw ( RuntimeException, std::exception )
{
- Guard aGuard( m_aLock );
-
+ SolarMutexGuard g;
if (( aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING ) ||
( aEvent.Action == css::frame::FrameAction_COMPONENT_ATTACHED ))
{
@@ -291,8 +279,7 @@ throw ( RuntimeException, std::exception )
void SAL_CALL PopupMenuDispatcher::disposing( const EventObject& ) throw( RuntimeException, std::exception )
{
- // Ready for multithreading
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
// Safe impossible cases
SAL_WARN_IF( m_bAlreadyDisposed, "fwk", "MenuDispatcher::disposing(): Object already disposed .. don't call it again!" );