[Libreoffice-commits] core.git: 16 commits - framework/inc framework/source
Stephan Bergmann
sbergman at redhat.com
Tue Mar 18 01:43:46 PDT 2014
framework/inc/classes/framecontainer.hxx | 7
framework/inc/classes/menumanager.hxx | 6
framework/inc/dispatch/closedispatcher.hxx | 6
framework/inc/dispatch/dispatchinformationprovider.hxx | 4
framework/inc/dispatch/dispatchprovider.hxx | 8
framework/inc/dispatch/interceptionhelper.hxx | 5
framework/inc/dispatch/mailtodispatcher.hxx | 9
framework/inc/dispatch/menudispatcher.hxx | 11
framework/inc/dispatch/popupmenudispatcher.hxx | 11
framework/inc/dispatch/servicehandler.hxx | 9
framework/inc/dispatch/startmoduledispatcher.hxx | 6
framework/inc/interaction/quietinteraction.hxx | 4
framework/inc/services/desktop.hxx | 1
framework/source/accelerators/acceleratorconfiguration.cxx | 288 +++-------
framework/source/accelerators/documentacceleratorconfiguration.cxx | 55 -
framework/source/accelerators/moduleacceleratorconfiguration.cxx | 14
framework/source/accelerators/presethandler.cxx | 178 ++----
framework/source/classes/framecontainer.cxx | 65 --
framework/source/classes/menumanager.cxx | 26
framework/source/dispatch/closedispatcher.cxx | 102 +--
framework/source/dispatch/dispatchinformationprovider.cxx | 16
framework/source/dispatch/dispatchprovider.cxx | 89 +--
framework/source/dispatch/interceptionhelper.cxx | 26
framework/source/dispatch/mailtodispatcher.cxx | 15
framework/source/dispatch/menudispatcher.cxx | 27
framework/source/dispatch/popupmenudispatcher.cxx | 33 -
framework/source/dispatch/servicehandler.cxx | 17
framework/source/dispatch/startmoduledispatcher.cxx | 24
framework/source/inc/accelerators/acceleratorconfiguration.hxx | 7
framework/source/inc/accelerators/presethandler.hxx | 11
framework/source/interaction/quietinteraction.cxx | 21
framework/source/uielement/menubarmanager.cxx | 2
32 files changed, 389 insertions(+), 714 deletions(-)
New commits:
commit 309951d6d6fcea92a91b8074798158c00bf14040
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:42:35 2014 +0100
Access safe data members directly
Change-Id: Ide204709c54fa476b9cc4f6a9446a8fb2730950c
diff --git a/framework/inc/dispatch/startmoduledispatcher.hxx b/framework/inc/dispatch/startmoduledispatcher.hxx
index 681593b..3849ec6 100644
--- a/framework/inc/dispatch/startmoduledispatcher.hxx
+++ b/framework/inc/dispatch/startmoduledispatcher.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_STARTMODULEDISPATCHER_HXX
#define INCLUDED_FRAMEWORK_INC_DISPATCH_STARTMODULEDISPATCHER_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/generic.hxx>
@@ -48,9 +47,7 @@ namespace framework{
/**
@short helper to handle all URLs related to the StartModule
*/
-class StartModuleDispatcher : // baseclasses ... order is necessary for right initialization!
- private ThreadHelpBase,
- public ::cppu::WeakImplHelper2<
+class StartModuleDispatcher : public ::cppu::WeakImplHelper2<
css::frame::XNotifyingDispatch, // => XDispatch
css::frame::XDispatchInformationProvider >
{
@@ -75,6 +72,7 @@ class StartModuleDispatcher : // baseclasses ... order is necessary for right in
/** @short list of registered status listener */
+ osl::Mutex m_mutex;
ListenerHash m_lStatusListener;
diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx
index ce08b00..20bcb1a 100644
--- a/framework/source/dispatch/startmoduledispatcher.cxx
+++ b/framework/source/dispatch/startmoduledispatcher.cxx
@@ -21,7 +21,6 @@
#include <dispatch/startmoduledispatcher.hxx>
#include <pattern/frame.hxx>
-#include <threadhelp/guard.hxx>
#include <framework/framelistanalyzer.hxx>
#include <dispatchcommands.h>
#include <targets.h>
@@ -56,11 +55,10 @@ namespace fpf = ::framework::pattern::frame;
StartModuleDispatcher::StartModuleDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const css::uno::Reference< css::frame::XFrame >& xFrame ,
const OUString& sTarget)
- : ThreadHelpBase (&Application::GetSolarMutex() )
- , m_xContext (rxContext )
+ : m_xContext (rxContext )
, m_xOwner (xFrame )
, m_sDispatchTarget (sTarget )
- , m_lStatusListener (m_aLock.getShareableOslMutex())
+ , m_lStatusListener (m_mutex)
{
}
@@ -131,14 +129,8 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere
if ( ! SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE))
return sal_False;
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
- css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY);
+ css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY);
FrameListAnalyzer aCheck(
xDesktop,
@@ -162,17 +154,11 @@ void SAL_CALL StartModuleDispatcher::removeStatusListener(const css::uno::Refere
::sal_Bool StartModuleDispatcher::implts_establishBackingMode()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::frame::XDesktop2> xDesktop = css::frame::Desktop::create( xContext );
+ css::uno::Reference< css::frame::XDesktop2> xDesktop = css::frame::Desktop::create( m_xContext );
css::uno::Reference< css::frame::XFrame > xFrame = xDesktop->findFrame(SPECIALTARGET_BLANK, 0);
css::uno::Reference< css::awt::XWindow > xContainerWindow = xFrame->getContainerWindow();
- css::uno::Reference< css::frame::XController > xStartModule = css::frame::StartModule::createWithParentWindow(xContext, xContainerWindow);
+ css::uno::Reference< css::frame::XController > xStartModule = css::frame::StartModule::createWithParentWindow(m_xContext, xContainerWindow);
css::uno::Reference< css::awt::XWindow > xComponentWindow(xStartModule, css::uno::UNO_QUERY);
xFrame->setComponent(xComponentWindow, xStartModule);
xStartModule->attachFrame(xFrame);
commit 093df487b40ec38bb334180a874fcd314d6dad81
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:36:28 2014 +0100
Access safe data members directly
Change-Id: If0acaa04b61a72f47b70cbbfc37c615c909d0c18
diff --git a/framework/inc/dispatch/servicehandler.hxx b/framework/inc/dispatch/servicehandler.hxx
index df66c86..c699d4d 100644
--- a/framework/inc/dispatch/servicehandler.hxx
+++ b/framework/inc/dispatch/servicehandler.hxx
@@ -24,7 +24,6 @@
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <general.h>
#include <stdtypes.h>
@@ -49,18 +48,12 @@ namespace framework{
service must be hold his self alive. Such mechanism can be useful for UI components
(e.g. Dialogs, Wizards) only.
- @base ThreadHelpBase
- exports a lock member to guarantee right initialize value of it
@base OWeakObject
provides XWeak and ref count mechanism
@devstatus ready to use
*/
-class ServiceHandler : // baseclasses
- // Order is necessary for right initialization!
- private ThreadHelpBase ,
- // interfaces
- public ::cppu::WeakImplHelper3<
+class ServiceHandler : public ::cppu::WeakImplHelper3<
css::lang::XServiceInfo ,
css::frame::XDispatchProvider ,
css::frame::XNotifyingDispatch > // => XDispatch
diff --git a/framework/source/dispatch/servicehandler.cxx b/framework/source/dispatch/servicehandler.cxx
index 66a7c99..1714524 100644
--- a/framework/source/dispatch/servicehandler.cxx
+++ b/framework/source/dispatch/servicehandler.cxx
@@ -18,7 +18,6 @@
*/
#include <dispatch/servicehandler.hxx>
-#include <threadhelp/guard.hxx>
#include <general.h>
#include <services.h>
@@ -60,10 +59,7 @@ DEFINE_INIT_SERVICE(ServiceHandler,
reference to uno servicemanager for creation of new services
*/
ServiceHandler::ServiceHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory )
- // Init baseclasses first
- : ThreadHelpBase( &Application::GetSolarMutex() )
- // Init member
- , m_xFactory ( xFactory )
+ : m_xFactory ( xFactory )
{
}
@@ -75,7 +71,6 @@ ServiceHandler::ServiceHandler( const css::uno::Reference< css::lang::XMultiServ
*/
ServiceHandler::~ServiceHandler()
{
- m_xFactory = NULL;
}
@@ -199,13 +194,7 @@ void SAL_CALL ServiceHandler::dispatchWithNotification( const css::util::URL&
css::uno::Reference< css::uno::XInterface > ServiceHandler::implts_dispatch( const css::util::URL& aURL ,
const css::uno::Sequence< css::beans::PropertyValue >& /*lArguments*/ ) throw( css::uno::RuntimeException )
{
- /* SAFE */
- Guard aReadLock( m_aLock );
- css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory;
- aReadLock.unlock();
- /* SAFE */
-
- if (!xFactory.is())
+ if (!m_xFactory.is())
return css::uno::Reference< css::uno::XInterface >();
// extract service name and may optional given parameters from given URL
@@ -237,7 +226,7 @@ css::uno::Reference< css::uno::XInterface > ServiceHandler::implts_dispatch( con
try
{
// => a) a service starts running inside his own ctor and we create it only
- xService = xFactory->createInstance(sServiceName);
+ xService = m_xFactory->createInstance(sServiceName);
// or b) he implements the right interface and starts there (may with optional parameters)
css::uno::Reference< css::task::XJobExecutor > xExecuteable(xService, css::uno::UNO_QUERY);
if (xExecuteable.is())
commit 31052b36be1dbf39263ecf23496a5c041a805884
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:34:52 2014 +0100
Use SolarMutexGuard directly
Change-Id: I2ae1a43862754030f88df033551c93fdbeeab14a
diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx
index 8b58855..4a0ed09 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 3a91779..1f29b10 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!" );
commit c63f42e26ac61ef776fc7aa125d695f742358dc4
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:31:28 2014 +0100
Use SolarMutexGuard directly
Change-Id: Ieb26a4b63bc93254c54b18c209514aee55186407
diff --git a/framework/inc/dispatch/menudispatcher.hxx b/framework/inc/dispatch/menudispatcher.hxx
index 9cb73ae..588ecd4 100644
--- a/framework/inc/dispatch/menudispatcher.hxx
+++ b/framework/inc/dispatch/menudispatcher.hxx
@@ -24,7 +24,6 @@
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <classes/menumanager.hxx>
#include <general.h>
#include <stdtypes.h>
@@ -67,16 +66,11 @@ typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< OUString ,
XLoadEventListener
XFrameActionListener
XEventListener
- @base ThreadHelpBase
- OWeakObject
+ @base OWeakObject
@devstatus ready to use
*//*-*************************************************************************************************************/
-class MenuDispatcher : // baseclasses
- // Order is necessary for right initialization!
- public ThreadHelpBase ,
- // interfaces
- public ::cppu::WeakImplHelper2<
+class MenuDispatcher : public ::cppu::WeakImplHelper2<
css::frame::XDispatch ,
css::frame::XFrameActionListener >
{
@@ -250,6 +244,7 @@ class MenuDispatcher : // baseclasses
css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak ; /// css::uno::WeakReference to owner (Don't use a hard css::uno::Reference. Owner can't delete us then!)
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/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx
index a775af3..85b1c6c 100644
--- a/framework/source/dispatch/menudispatcher.cxx
+++ b/framework/source/dispatch/menudispatcher.cxx
@@ -21,7 +21,6 @@
#include <general.h>
#include <framework/menuconfiguration.hxx>
#include <framework/addonmenu.hxx>
-#include <threadhelp/guard.hxx>
#include <services.h>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -70,12 +69,9 @@ static sal_Bool impldbg_checkParameter_removeStatusListener ( const css::uno
MenuDispatcher::MenuDispatcher( const uno::Reference< XComponentContext >& xContext ,
const uno::Reference< XFrame >& xOwner )
- // Init baseclasses first
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- // Init member
- , m_xOwnerWeak ( xOwner )
+ : m_xOwnerWeak ( xOwner )
, m_xContext ( xContext )
- , m_aListenerContainer ( m_aLock.getShareableOslMutex() )
+ , m_aListenerContainer ( m_mutex )
, m_bAlreadyDisposed ( sal_False )
, m_bActivateListener ( sal_False )
, m_pMenuManager ( NULL )
@@ -112,8 +108,7 @@ void SAL_CALL MenuDispatcher::dispatch( const URL& /
void SAL_CALL MenuDispatcher::addStatusListener( const uno::Reference< XStatusListener >& xControl,
const URL& aURL ) throw( RuntimeException, std::exception )
{
- // Ready for multithreading
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
// Safe impossible cases
// Method not defined for all incoming parameter
SAL_WARN_IF( !impldbg_checkParameter_addStatusListener( xControl, aURL ), "fwk", "MenuDispatcher::addStatusListener(): Invalid parameter detected." );
@@ -127,8 +122,7 @@ void SAL_CALL MenuDispatcher::addStatusListener( const uno::Reference< XStat
void SAL_CALL MenuDispatcher::removeStatusListener( const uno::Reference< XStatusListener >& xControl,
const URL& aURL ) throw( RuntimeException, std::exception )
{
- // Ready for multithreading
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
// Safe impossible cases
// Method not defined for all incoming parameter
SAL_WARN_IF( !impldbg_checkParameter_removeStatusListener( xControl, aURL ), "fwk", "MenuDispatcher::removeStatusListener(): Invalid parameter detected." );
@@ -142,19 +136,19 @@ void SAL_CALL MenuDispatcher::removeStatusListener( const uno::Reference< X
void SAL_CALL MenuDispatcher::frameAction( const FrameActionEvent& aEvent ) throw ( RuntimeException, std::exception )
{
- Guard aGuard( m_aLock );
+ SolarMutexResettableGuard aGuard;
if ( m_pMenuManager && aEvent.Action == FrameAction_FRAME_UI_ACTIVATED )
{
MenuBar* pMenuBar = (MenuBar *)m_pMenuManager->GetMenu();
uno::Reference< XFrame > xFrame( m_xOwnerWeak.get(), UNO_QUERY );
- aGuard.unlock();
+ aGuard.clear();
if ( xFrame.is() && pMenuBar )
{
uno::Reference< ::com::sun::star::awt::XWindow >xContainerWindow = xFrame->getContainerWindow();
- SolarMutexGuard aSolarGuard;
+ aGuard.reset();
{
Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
while ( pWindow && !pWindow->IsSystemWindow() )
@@ -179,8 +173,7 @@ void SAL_CALL MenuDispatcher::frameAction( const FrameActionEvent& aEvent ) thro
// XEventListener
void SAL_CALL MenuDispatcher::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!" );
@@ -244,7 +237,6 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
uno::Reference< ::com::sun::star::awt::XWindow >xContainerWindow = xFrame->getContainerWindow();
Window* pWindow = NULL;
- // Use SolarMutex for threadsafe code too!
SolarMutexGuard aSolarGuard;
{
pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
@@ -254,9 +246,6 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR
if ( pWindow )
{
- // Ready for multithreading
- Guard aGuard( m_aLock );
-
SystemWindow* pSysWindow = (SystemWindow *)pWindow;
if ( m_pMenuManager )
commit 8ca1c57f0449c951515c3c3b448d0acda56b26fb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:26:05 2014 +0100
Access safe data members directly
Change-Id: I06df992ca9a77e8ac21dbd1faffa9fa906daab62
diff --git a/framework/inc/dispatch/mailtodispatcher.hxx b/framework/inc/dispatch/mailtodispatcher.hxx
index 1053384..5e283ce 100644
--- a/framework/inc/dispatch/mailtodispatcher.hxx
+++ b/framework/inc/dispatch/mailtodispatcher.hxx
@@ -24,7 +24,6 @@
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <general.h>
#include <stdtypes.h>
@@ -46,18 +45,12 @@ namespace framework{
@descr It's a special dispatch object which is used registered for "mailto:*" URLs and
will be automaticly used from the framework dispatch mechanism if such URL occurred.
- @base ThreadHelpBase
- exports a lock member to guarantee right initialize value of it
@base OWeakObject
provides XWeak and ref count mechanism
@devstatus ready to use
*/
-class MailToDispatcher : // baseclasses
- // Order is necessary for right initialization!
- private ThreadHelpBase ,
- // interfaces
- public ::cppu::WeakImplHelper3<
+class MailToDispatcher : public ::cppu::WeakImplHelper3<
css::lang::XServiceInfo,
css::frame::XDispatchProvider,
css::frame::XNotifyingDispatch> // => XDispatch
diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx
index 0be69d9..1d008a6 100644
--- a/framework/source/dispatch/mailtodispatcher.cxx
+++ b/framework/source/dispatch/mailtodispatcher.cxx
@@ -18,7 +18,6 @@
*/
#include <dispatch/mailtodispatcher.hxx>
-#include <threadhelp/guard.hxx>
#include <general.h>
#include <services.h>
@@ -58,10 +57,7 @@ DEFINE_INIT_SERVICE(MailToDispatcher,
reference to uno servicemanager for creation of new services
*/
MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
- // Init baseclasses first
- : ThreadHelpBase( &Application::GetSolarMutex() )
- // Init member
- , m_xContext ( rxContext )
+ : m_xContext ( rxContext )
{
}
@@ -73,7 +69,6 @@ MailToDispatcher::MailToDispatcher( const css::uno::Reference< css::uno::XCompon
*/
MailToDispatcher::~MailToDispatcher()
{
- m_xContext = NULL;
}
@@ -200,13 +195,7 @@ sal_Bool MailToDispatcher::implts_dispatch( const css::util::URL&
{
sal_Bool bSuccess = sal_False;
- css::uno::Reference< css::uno::XComponentContext > xContext;
- /* SAFE */{
- Guard aReadLock( m_aLock );
- xContext = m_xContext;
- /* SAFE */}
-
- css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute = css::system::SystemShellExecute::create( xContext );
+ css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute = css::system::SystemShellExecute::create( m_xContext );
try
{
commit 43ed93b2563c7862b7aefbe54238725faa3c5639
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:21:23 2014 +0100
Use SolarMutexGuard directly
Change-Id: Ia8c994a86f1693dd1f06b2f1183f392e0ba4bdd2
diff --git a/framework/inc/dispatch/interceptionhelper.hxx b/framework/inc/dispatch/interceptionhelper.hxx
index 2f2162e..96e3a2b 100644
--- a/framework/inc/dispatch/interceptionhelper.hxx
+++ b/framework/inc/dispatch/interceptionhelper.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_INTERCEPTIONHELPER_HXX
#define INCLUDED_FRAMEWORK_INC_DISPATCH_INTERCEPTIONHELPER_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx>
#include <macros/generic.hxx>
#include <general.h>
@@ -48,9 +47,7 @@ namespace framework{
@attention Don't use this class as direct member - use it dynamicly. Do not derive from this class.
We hold a weakreference to ouer owner not to ouer superclass.
*/
-class InterceptionHelper : // order of base classes is important for right initialization of mutex member!
- private ThreadHelpBase,
- public ::cppu::WeakImplHelper3<
+class InterceptionHelper : public ::cppu::WeakImplHelper3<
css::frame::XDispatchProvider,
css::frame::XDispatchProviderInterception,
css::lang::XEventListener >
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index 6bed175..cec5a55 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -18,7 +18,6 @@
*/
#include <dispatch/interceptionhelper.hxx>
-#include <threadhelp/guard.hxx>
#include <com/sun/star/frame/XInterceptorInfo.hpp>
@@ -34,10 +33,7 @@ sal_Bool InterceptionHelper::m_bPreferrFirstInterceptor = sal_True;
InterceptionHelper::InterceptionHelper(const css::uno::Reference< css::frame::XFrame >& xOwner,
const css::uno::Reference< css::frame::XDispatchProvider >& xSlave)
- // Init baseclasses first
- : ThreadHelpBase(&Application::GetSolarMutex())
- // Init member
- , m_xOwnerWeak (xOwner )
+ : m_xOwnerWeak (xOwner )
, m_xSlave (xSlave )
{
}
@@ -52,7 +48,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
throw(css::uno::RuntimeException, std::exception)
{
// SAFE {
- Guard aReadLock(m_aLock);
+ SolarMutexClearableGuard aReadLock;
// a) first search an interceptor, which match to this URL by it's URL pattern registration
// Note: if it return NULL - it does not mean an empty interceptor list automaticly!
@@ -78,7 +74,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD
if (!xInterceptor.is() && m_xSlave.is())
xInterceptor = m_xSlave;
- aReadLock.unlock();
+ aReadLock.clear();
// } SAFE
css::uno::Reference< css::frame::XDispatch > xReturn;
@@ -125,7 +121,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
}
// SAFE {
- Guard aWriteLock(m_aLock);
+ SolarMutexClearableGuard aWriteLock;
// a) no interceptor at all - set this instance as master for given interceptor
// and set our slave as it's slave - and put this interceptor to the list.
@@ -172,7 +168,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css:
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
- aWriteLock.unlock();
+ aWriteLock.clear();
// } SAFE
// Don't forget to send a frame action event "context changed".
@@ -190,7 +186,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
throw css::uno::RuntimeException("NULL references not allowed as in parameter", xThis);
// SAFE {
- Guard aWriteLock(m_aLock);
+ SolarMutexClearableGuard aWriteLock;
// search this interceptor ...
// If it could be located inside cache -
@@ -219,7 +215,7 @@ void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
- aWriteLock.unlock();
+ aWriteLock.clear();
// } SAFE
// Don't forget to send a frame action event "context changed".
@@ -234,7 +230,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
{
#ifdef FORCE_DESTRUCTION_OF_INTERCEPTION_CHAIN
// SAFE ->
- Guard aReadLock(m_aLock);
+ SolarMutexResettableGuard aReadLock;
// check calli ... we accept such disposing call's only from our onwer frame.
css::uno::Reference< css::frame::XFrame > xOwner(m_xOwnerWeak.get(), css::uno::UNO_QUERY);
@@ -250,7 +246,7 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
// Because this vetor will be influenced by every deregistered interceptor.
InterceptionHelper::InterceptorList aCopy = m_lInterceptionRegs;
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
InterceptionHelper::InterceptorList::iterator pIt;
@@ -271,10 +267,10 @@ void SAL_CALL InterceptionHelper::disposing(const css::lang::EventObject& aEvent
#if OSL_DEBUG_LEVEL > 0
// SAFE ->
- aReadLock.lock();
+ aReadLock.reset();
if (!m_lInterceptionRegs.empty() )
OSL_FAIL("There are some pending interceptor objects, which seems to be registered during (!) the destruction of a frame.");
- aReadLock.unlock();
+ aReadLock.clear();
// <- SAFE
#endif // ODL_DEBUG_LEVEL>0
commit 445ec65a85624e4505c91c31f81c978a3d639c18
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:17:32 2014 +0100
Use SolarMutexGuard directly
Change-Id: Iddb38d3404a8b1a4e33e291e1f51ad63cacaa255
diff --git a/framework/inc/interaction/quietinteraction.hxx b/framework/inc/interaction/quietinteraction.hxx
index 31ff8ab..3aba561 100644
--- a/framework/inc/interaction/quietinteraction.hxx
+++ b/framework/inc/interaction/quietinteraction.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
#define INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <general.h>
@@ -44,8 +43,7 @@ namespace framework{
- InteractiveAugmentedIOException
All other requests will be aborted.
*/
-class QuietInteraction : private ThreadHelpBase
- , public ::cppu::WeakImplHelper1<
+class QuietInteraction : public ::cppu::WeakImplHelper1<
css::task::XInteractionHandler >
{
// member
diff --git a/framework/source/interaction/quietinteraction.cxx b/framework/source/interaction/quietinteraction.cxx
index 2ec220c..1717bf0 100644
--- a/framework/source/interaction/quietinteraction.cxx
+++ b/framework/source/interaction/quietinteraction.cxx
@@ -19,7 +19,6 @@
#include "interaction/quietinteraction.hxx"
-#include <threadhelp/guard.hxx>
#include <macros/generic.hxx>
#include <com/sun/star/task/XInteractionAbort.hpp>
@@ -43,8 +42,7 @@ namespace framework{
QuietInteraction::QuietInteraction()
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- , m_aRequest ( )
+ : m_aRequest ( )
{
}
@@ -54,11 +52,10 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI
{
// safe the request for outside analyzing everytime!
css::uno::Any aRequest = xRequest->getRequest();
- /* SAFE { */
- Guard aWriteLock(m_aLock);
- m_aRequest = aRequest;
- aWriteLock.unlock();
- /* } SAFE */
+ {
+ SolarMutexGuard g;
+ m_aRequest = aRequest;
+ }
// analyze the request
// We need XAbort as possible continuation as minimum!
@@ -141,20 +138,16 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI
css::uno::Any QuietInteraction::getRequest() const
{
- /* SAFE { */
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
return m_aRequest;
- /* } SAFE */
}
sal_Bool QuietInteraction::wasUsed() const
{
- /* SAFE { */
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
return m_aRequest.hasValue();
- /* } SAFE */
}
} // namespace framework
commit 15bb864ea81b64ecfdd69e8831fb729ca44a542e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:15:20 2014 +0100
Use SolarMutexGuard directly
(and access safe data members directly)
Change-Id: I4a033fc2acd858534d329023c72c278f8b4b9244
diff --git a/framework/inc/dispatch/dispatchprovider.hxx b/framework/inc/dispatch/dispatchprovider.hxx
index 1b7c0d7..cdfe19e 100644
--- a/framework/inc/dispatch/dispatchprovider.hxx
+++ b/framework/inc/dispatch/dispatchprovider.hxx
@@ -21,7 +21,6 @@
#define INCLUDED_FRAMEWORK_INC_DISPATCH_DISPATCHPROVIDER_HXX
#include <classes/protocolhandlercache.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <threadhelp/transactionbase.hxx>
#include <macros/xinterface.hxx>
@@ -69,18 +68,13 @@ enum EDispatchHelper
@attention Use this class as member only! Never use it as baseclass.
XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS!
- @base ThreadHelpBase
- supports threadsafe mechanism
@base OWeakObject
provides ref count and weak mechanism
@devstatus ready to use
@threadsafe yes
*/
-class DispatchProvider : // baseclasses
- // Order is necessary for right initialization!
- private ThreadHelpBase ,
- private TransactionBase ,
+class DispatchProvider : private TransactionBase ,
// interfaces
public ::cppu::WeakImplHelper1< css::frame::XDispatchProvider >
{
diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx
index 7fc0208..1ec53d0 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -27,7 +27,6 @@
#include <pattern/window.hxx>
#include <threadhelp/transactionguard.hxx>
-#include <threadhelp/guard.hxx>
#include <dispatchcommands.h>
#include <protocols.h>
#include <services.h>
@@ -64,10 +63,7 @@ namespace framework{
*/
DispatchProvider::DispatchProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
const css::uno::Reference< css::frame::XFrame >& xFrame )
- // Init baseclasses first
- : ThreadHelpBase( &Application::GetSolarMutex() )
- // Init member
- , m_xContext ( rxContext )
+ : m_xContext ( rxContext )
, m_xFrame ( xFrame )
{
}
@@ -105,11 +101,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL DispatchProvider::queryDis
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
- /* SAFE { */
- Guard aReadLock( m_aLock );
- css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
- aReadLock.unlock();
- /* } SAFE */
+ css::uno::Reference< css::frame::XFrame > xOwner(m_xFrame);
css::uno::Reference< css::frame::XDesktop > xDesktopCheck( xOwner, css::uno::UNO_QUERY );
@@ -490,42 +482,40 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProt
// This member is threadsafe by himself and lives if we live - we don't need any mutex here.
if (m_aProtocolHandlerCache.search(aURL,&aHandler))
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
- // create it
css::uno::Reference< css::frame::XDispatchProvider > xHandler;
- try
{
- xHandler = css::uno::Reference< css::frame::XDispatchProvider >(
- css::uno::Reference<css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW)
- ->createInstance(aHandler.m_sUNOName),
- css::uno::UNO_QUERY);
- }
- catch(const css::uno::Exception&) {}
+ SolarMutexGuard g;
- // look if initialization is necessary
- css::uno::Reference< css::lang::XInitialization > xInit( xHandler, css::uno::UNO_QUERY );
- if (xInit.is())
- {
- css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
- SAL_WARN_IF(!xOwner.is(), "fwk", "DispatchProvider::implts_searchProtocolHandler(): Couldn't get reference to my owner frame. So I can't set may needed context information for this protocol handler.");
- if (xOwner.is())
+ // create it
+ try
+ {
+ xHandler = css::uno::Reference< css::frame::XDispatchProvider >(
+ css::uno::Reference<css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW)
+ ->createInstance(aHandler.m_sUNOName),
+ css::uno::UNO_QUERY);
+ }
+ catch(const css::uno::Exception&) {}
+
+ // look if initialization is necessary
+ css::uno::Reference< css::lang::XInitialization > xInit( xHandler, css::uno::UNO_QUERY );
+ if (xInit.is())
{
- try
+ css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
+ SAL_WARN_IF(!xOwner.is(), "fwk", "DispatchProvider::implts_searchProtocolHandler(): Couldn't get reference to my owner frame. So I can't set may needed context information for this protocol handler.");
+ if (xOwner.is())
{
- // but do it only, if all context information are OK
- css::uno::Sequence< css::uno::Any > lContext(1);
- lContext[0] <<= xOwner;
- xInit->initialize(lContext);
+ try
+ {
+ // but do it only, if all context information are OK
+ css::uno::Sequence< css::uno::Any > lContext(1);
+ lContext[0] <<= xOwner;
+ xInit->initialize(lContext);
+ }
+ catch(const css::uno::Exception&) {}
}
- catch(const css::uno::Exception&) {}
}
}
- aReadLock.unlock();
- /* } SAFE */
-
// ask for his (sub)dispatcher for the given URL
if (xHandler.is())
xDispatcher = xHandler->queryDispatch(aURL,SPECIALTARGET_SELF,0);
@@ -566,34 +556,25 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
{
css::uno::Reference< css::frame::XDispatch > xDispatchHelper;
- /* SAFE { */
- Guard aReadLock( m_aLock );
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- /* } SAFE */
-
switch (eHelper)
{
case E_MENUDISPATCHER :
{
// Attention: Such menue dispatcher must be a singleton for this frame - means our owner frame.
// Otherwhise he can make some trouble.
- /* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
if ( ! m_xMenuDispatcher.is() )
{
- MenuDispatcher* pDispatcher = new MenuDispatcher( xContext, xOwner );
+ MenuDispatcher* pDispatcher = new MenuDispatcher( m_xContext, xOwner );
m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
xDispatchHelper = m_xMenuDispatcher;
- aWriteLock.unlock();
- /* } SAFE */
}
break;
case E_CREATEDISPATCHER :
{
- LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, sTarget, nSearchFlags);
+ LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, sTarget, nSearchFlags);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
@@ -603,7 +584,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
if (xDesktop.is())
{
- LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, SPECIALTARGET_BLANK, 0);
+ LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_BLANK, 0);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
}
@@ -614,7 +595,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
if (xDesktop.is())
{
- LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, SPECIALTARGET_DEFAULT, 0);
+ LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_DEFAULT, 0);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
}
@@ -622,21 +603,21 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreat
case E_SELFDISPATCHER :
{
- LoadDispatcher* pDispatcher = new LoadDispatcher(xContext, xOwner, SPECIALTARGET_SELF, 0);
+ LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_SELF, 0);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
case E_CLOSEDISPATCHER :
{
- CloseDispatcher* pDispatcher = new CloseDispatcher( xContext, xOwner, sTarget );
+ CloseDispatcher* pDispatcher = new CloseDispatcher( m_xContext, xOwner, sTarget );
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
case E_STARTMODULEDISPATCHER :
{
- StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( xContext, xOwner, sTarget );
+ StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( m_xContext, xOwner, sTarget );
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
commit faef574c5572035cbc7808a52e80ff946bc745cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 09:09:29 2014 +0100
Access safe data members directly
Change-Id: I077318a2ecb9b3d9708930742c458422aadeb064
diff --git a/framework/inc/dispatch/dispatchinformationprovider.hxx b/framework/inc/dispatch/dispatchinformationprovider.hxx
index 1f5fcb2..66af207 100644
--- a/framework/inc/dispatch/dispatchinformationprovider.hxx
+++ b/framework/inc/dispatch/dispatchinformationprovider.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX
#define INCLUDED_FRAMEWORK_INC_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <general.h>
@@ -39,8 +38,7 @@ namespace framework{
/*-************************************************************************************************************
@short a helper to merge dispatch information of different sources together.
*//*-*************************************************************************************************************/
-class DispatchInformationProvider : private ThreadHelpBase
- , public ::cppu::WeakImplHelper1< css::frame::XDispatchInformationProvider >
+class DispatchInformationProvider : public ::cppu::WeakImplHelper1< css::frame::XDispatchInformationProvider >
{
// member
diff --git a/framework/source/dispatch/dispatchinformationprovider.cxx b/framework/source/dispatch/dispatchinformationprovider.cxx
index 0c7a749..dbb45dd 100644
--- a/framework/source/dispatch/dispatchinformationprovider.cxx
+++ b/framework/source/dispatch/dispatchinformationprovider.cxx
@@ -19,7 +19,6 @@
#include <dispatch/dispatchinformationprovider.hxx>
#include <dispatch/closedispatcher.hxx>
-#include <threadhelp/guard.hxx>
#include <stdtypes.h>
#include <services.h>
@@ -34,8 +33,7 @@ namespace framework{
DispatchInformationProvider::DispatchInformationProvider(const css::uno::Reference< css::uno::XComponentContext >& xContext ,
const css::uno::Reference< css::frame::XFrame >& xFrame)
- : ThreadHelpBase(&Application::GetSolarMutex())
- , m_xContext (xContext )
+ : m_xContext (xContext )
, m_xFrame (xFrame )
{
}
@@ -130,22 +128,16 @@ css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL DispatchInformati
css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > DispatchInformationProvider::implts_getAllSubProvider()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY);
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
+ css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame);
if (!xFrame.is())
return css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > >();
- CloseDispatcher* pCloser = new CloseDispatcher(xContext, xFrame, OUString("_self")); // explicit "_self" ... not "" ... see implementation of close dispatcher itself!
+ CloseDispatcher* pCloser = new CloseDispatcher(m_xContext, xFrame, OUString("_self")); // explicit "_self" ... not "" ... see implementation of close dispatcher itself!
css::uno::Reference< css::uno::XInterface > xCloser(static_cast< css::frame::XDispatch* >(pCloser), css::uno::UNO_QUERY);
css::uno::Reference< css::frame::XDispatchInformationProvider > xCloseDispatch(xCloser , css::uno::UNO_QUERY);
css::uno::Reference< css::frame::XDispatchInformationProvider > xController (xFrame->getController() , css::uno::UNO_QUERY);
- css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher = css::frame::AppDispatchProvider::create(xContext);
+ css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher = css::frame::AppDispatchProvider::create(m_xContext);
css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > lProvider(3);
lProvider[0] = xController ;
lProvider[1] = xCloseDispatch;
commit 9a67d4f419a3487b553441aa49361e7d07a0614b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 08:56:42 2014 +0100
Use SolarMutexGuard directly
Change-Id: Iaf7a74fed1846ce39de01cc343d7a75763e81e50
diff --git a/framework/inc/dispatch/closedispatcher.hxx b/framework/inc/dispatch/closedispatcher.hxx
index f5cdb15..37064bf 100644
--- a/framework/inc/dispatch/closedispatcher.hxx
+++ b/framework/inc/dispatch/closedispatcher.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_CLOSEDISPATCHER_HXX
#define INCLUDED_FRAMEWORK_INC_DISPATCH_CLOSEDISPATCHER_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/generic.hxx>
@@ -56,9 +55,7 @@ namespace framework{
or some other menu entries. Or we terminate the whole application in case this backing mode should not
be used.
*/
-class CloseDispatcher : // baseclasses ... order is necessary for right initialization!
- private ThreadHelpBase
- , public ::cppu::WeakImplHelper2<
+class CloseDispatcher : public ::cppu::WeakImplHelper2<
css::frame::XNotifyingDispatch, // => XDispatch
css::frame::XDispatchInformationProvider >
{
@@ -111,6 +108,7 @@ class CloseDispatcher : // baseclasses ... order is necessary for right initiali
/** @short list of registered status listener */
+ osl::Mutex m_mutex;
ListenerHash m_lStatusListener;
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index f21ec96..7c228ec 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -19,7 +19,6 @@
#include <dispatch/closedispatcher.hxx>
#include <pattern/frame.hxx>
-#include <threadhelp/guard.hxx>
#include <framework/framelistanalyzer.hxx>
#include <services.h>
#include <general.h>
@@ -60,11 +59,10 @@ const char URL_CLOSEFRAME[] = ".uno:CloseFrame";
CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
const css::uno::Reference< css::frame::XFrame >& xFrame ,
const OUString& sTarget)
- : ThreadHelpBase (&Application::GetSolarMutex() )
- , m_xContext (rxContext )
+ : m_xContext (rxContext )
, m_aAsyncCallback (LINK( this, CloseDispatcher, impl_asyncCallback))
, m_eOperation(E_CLOSE_DOC)
- , m_lStatusListener (m_aLock.getShareableOslMutex() )
+ , m_lStatusListener(m_mutex)
, m_pSysWindow(NULL)
{
uno::Reference<frame::XFrame> xTarget = static_impl_searchRightTargetFrame(xFrame, sTarget);
@@ -149,7 +147,7 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
throw(css::uno::RuntimeException, std::exception)
{
// SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
+ SolarMutexClearableGuard aWriteLock;
// This reference indicates, that we was already called before and
// our asynchronous process was not finished yet.
@@ -159,7 +157,7 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
// non of these jobs was successfully.
if (m_xSelfHold.is())
{
- aWriteLock.unlock();
+ aWriteLock.clear();
// <- SAFE ------------------------------
implts_notifyResultListener(
@@ -181,7 +179,7 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
m_eOperation = E_CLOSE_FRAME;
else
{
- aWriteLock.unlock();
+ aWriteLock.clear();
// <- SAFE ------------------------------
implts_notifyResultListener(
@@ -211,7 +209,7 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
m_xResultListener = xListener;
m_xSelfHold = css::uno::Reference< css::uno::XInterface >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- aWriteLock.unlock();
+ aWriteLock.clear();
// <- SAFE ----------------------------------
sal_Bool bIsSynchron = sal_False;
@@ -258,21 +256,23 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback)
sal_Bool bAllowSuspend = sal_True;
sal_Bool bControllerSuspended = sal_False;
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
-
- // Closing of all views, related to the same document, is allowed
- // only if the dispatched URL was ".uno:CloseDoc"!
- sal_Bool bCloseAllViewsToo = (m_eOperation == E_CLOSE_DOC);
+ sal_Bool bCloseAllViewsToo;
+ EOperation eOperation;
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ css::uno::Reference< css::frame::XFrame > xCloseFrame;
+ css::uno::Reference< css::frame::XDispatchResultListener > xListener;
+ {
+ SolarMutexGuard g;
- // BTW: Make some copies, which are needed later ...
- EOperation eOperation = m_eOperation;
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- css::uno::Reference< css::frame::XFrame > xCloseFrame (m_xCloseFrame.get(), css::uno::UNO_QUERY);
- css::uno::Reference< css::frame::XDispatchResultListener > xListener = m_xResultListener;
+ // Closing of all views, related to the same document, is allowed
+ // only if the dispatched URL was ".uno:CloseDoc"!
+ bCloseAllViewsToo = (m_eOperation == E_CLOSE_DOC);
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ eOperation = m_eOperation;
+ xContext = m_xContext;
+ xCloseFrame.set(m_xCloseFrame.get(), css::uno::UNO_QUERY);
+ xListener = m_xResultListener;
+ }
// frame already dead ?!
// Nothing to do !
@@ -409,9 +409,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback)
nState = css::frame::DispatchResultState::SUCCESS;
implts_notifyResultListener(xListener, nState, css::uno::Any());
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
-
+ SolarMutexGuard g;
// This method was called asynchronous from our main thread by using a pointer.
// We reached this method only, by using a reference to ourself :-)
// Further this member is used to detect still running and not yet finished
@@ -420,10 +418,6 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback)
css::uno::Reference< css::uno::XInterface > xTempHold = m_xSelfHold;
m_xSelfHold.clear();
m_xResultListener.clear();
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
}
catch(const css::lang::DisposedException&)
{
@@ -448,11 +442,11 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc
// will show the "save/discard/cancel" dialog for the last view only!
if (bCloseAllOtherViewsToo)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ {
+ SolarMutexGuard g;
+ xContext = m_xContext;
+ }
css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY_THROW);
FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL);
@@ -488,11 +482,11 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc
sal_Bool CloseDispatcher::implts_closeFrame()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::frame::XFrame > xFrame (m_xCloseFrame.get(), css::uno::UNO_QUERY);
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::frame::XFrame > xFrame;
+ {
+ SolarMutexGuard g;
+ xFrame.set(m_xCloseFrame.get(), css::uno::UNO_QUERY);
+ }
// frame already dead ? => so it's closed ... it's closed ...
if ( ! xFrame.is() )
@@ -504,11 +498,10 @@ sal_Bool CloseDispatcher::implts_closeFrame()
if (!fpf::closeIt(xFrame, sal_False))
return sal_False;
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
- m_xCloseFrame = css::uno::WeakReference< css::frame::XFrame >();
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
+ {
+ SolarMutexGuard g;
+ m_xCloseFrame = css::uno::WeakReference< css::frame::XFrame >();
+ }
return sal_True;
}
@@ -516,12 +509,13 @@ sal_Bool CloseDispatcher::implts_closeFrame()
sal_Bool CloseDispatcher::implts_establishBackingMode()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- css::uno::Reference< css::frame::XFrame > xFrame (m_xCloseFrame.get(), css::uno::UNO_QUERY);
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ css::uno::Reference< css::frame::XFrame > xFrame;
+ {
+ SolarMutexGuard g;
+ xContext = m_xContext;
+ xFrame.set(m_xCloseFrame.get(), css::uno::UNO_QUERY);
+ }
if (!xFrame.is())
return sal_False;
@@ -547,11 +541,11 @@ sal_Bool CloseDispatcher::implts_establishBackingMode()
sal_Bool CloseDispatcher::implts_terminateApplication()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ {
+ SolarMutexGuard g;
+ xContext = m_xContext;
+ }
css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext );
commit 99b6c3d4135f384d49951519aa9d0fba654dbd60
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 08:43:34 2014 +0100
Use SolarMutexGuard directly
Change-Id: I8c6a0873e2b0bb371775a2342292a819fe630b51
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx
index 968cb414..2a4fde6 100644
--- a/framework/inc/classes/menumanager.hxx
+++ b/framework/inc/classes/menumanager.hxx
@@ -32,7 +32,6 @@
#include <vcl/menu.hxx>
#include <vcl/accel.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <threadhelp/threadhelpbase.hxx>
namespace com { namespace sun { namespace star { namespace uno {
class XComponentContext;
@@ -44,8 +43,7 @@ namespace framework
class BmkMenu;
class AddonMenu;
class AddonPopupMenu;
-class MenuManager : public ThreadHelpBase ,
- public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
+class MenuManager : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
{
public:
MenuManager(
@@ -69,7 +67,7 @@ class MenuManager : public ThreadHelpBase ,
void RemoveListener();
- static void UpdateSpecialWindowMenu( Menu* pMenu ,const css::uno::Reference< css::uno::XComponentContext >& xContext, LockHelper& _rMutex);
+ static void UpdateSpecialWindowMenu( Menu* pMenu ,const css::uno::Reference< css::uno::XComponentContext >& xContext);
static void FillMenuImages(
css::uno::Reference< css::frame::XFrame >& xFrame,
Menu* _pMenu,
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index c4e20fb..8a6c0e3 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -22,7 +22,6 @@
#include <framework/bmkmenu.hxx>
#include <framework/addonmenu.hxx>
#include <framework/imageproducer.hxx>
-#include <threadhelp/guard.hxx>
#include "framework/addonsoptions.hxx"
#include <classes/fwkresid.hxx>
#include <services.h>
@@ -107,7 +106,6 @@ MenuManager::MenuManager(
const Reference< XComponentContext >& rxContext,
Reference< XFrame >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren )
:
- ThreadHelpBase( &Application::GetSolarMutex() ),
m_xContext(rxContext)
{
m_bActive = sal_False;
@@ -293,7 +291,7 @@ MenuManager::~MenuManager()
MenuManager::MenuItemHandler* MenuManager::GetMenuItemHandler( sal_uInt16 nItemId )
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p )
@@ -314,7 +312,7 @@ throw ( RuntimeException, std::exception )
MenuItemHandler* pStatusChangedMenu = NULL;
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p )
@@ -332,8 +330,6 @@ throw ( RuntimeException, std::exception )
{
SolarMutexGuard aSolarGuard;
{
- Guard aGuard( m_aLock );
-
sal_Bool bSetCheckmark = sal_False;
sal_Bool bCheckmark = sal_False;
sal_Bool bMenuItemEnabled = m_pVCLMenu->IsItemEnabled( pStatusChangedMenu->nItemId );
@@ -372,7 +368,7 @@ throw ( RuntimeException, std::exception )
void MenuManager::RemoveListener()
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
ClearMenuDispatch();
}
@@ -411,7 +407,7 @@ void SAL_CALL MenuManager::disposing( const EventObject& Source ) throw ( Runtim
{
if ( Source.Source == m_xFrame )
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
ClearMenuDispatch(Source,false);
}
else
@@ -420,7 +416,7 @@ void SAL_CALL MenuManager::disposing( const EventObject& Source ) throw ( Runtim
MenuItemHandler* pMenuItemDisposing = NULL;
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
std::vector< MenuItemHandler* >::iterator p;
for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p )
@@ -517,7 +513,7 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
int nRemoveItemCount = 0;
int nItemCount = pMenu->GetItemCount();
@@ -614,7 +610,7 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu )
}
}
-void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComponentContext >& xContext, LockHelper& _rMutex )
+void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComponentContext >& xContext )
{
// update window list
::std::vector< OUString > aNewWindowListVector;
@@ -648,7 +644,7 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XCompone
}
{
- Guard aGuard( _rMutex );
+ SolarMutexGuard g;
int nItemCount = pMenu->GetItemCount();
@@ -755,7 +751,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
if ( m_aMenuItemCommand == aSpecialFileMenu || m_aMenuItemCommand == aSlotSpecialFileMenu || aCommand == aSpecialFileCommand )
UpdateSpecialFileMenu( pMenu );
else if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aCommand == aSpecialWindowCommand )
- UpdateSpecialWindowMenu( pMenu, m_xContext, m_aLock );
+ UpdateSpecialWindowMenu( pMenu, m_xContext );
// Check if some modes have changed so we have to update our menu images
if ( bShowMenuImages != m_bShowMenuImages )
@@ -771,7 +767,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
{
URL aTargetURL;
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
if ( xDispatchProvider.is() )
@@ -841,7 +837,7 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
Reference< XDispatch > xDispatch;
{
- Guard aGuard( m_aLock );
+ SolarMutexGuard g;
sal_uInt16 nCurItemId = pMenu->GetCurItemId();
if ( pMenu == m_pVCLMenu &&
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 1773666..52d0fe1 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -818,7 +818,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
OUString aMenuCommand( m_aMenuItemCommand );
if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aMenuCommand == aSpecialWindowCommand )
- MenuManager::UpdateSpecialWindowMenu( pMenu, m_xContext, m_aLock );
+ MenuManager::UpdateSpecialWindowMenu( pMenu, m_xContext );
// Check if some modes have changed so we have to update our menu images
OUString sIconTheme = SvtMiscOptions().GetIconTheme();
commit 32a082a7b315fe09c1a715441ad067caf27fa787
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 08:36:11 2014 +0100
Use SolarMutexGuard directly
Change-Id: Ic133d616d730e332de7354d5de4a5ab21944378f
diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx
index 0866a5e..bb30075 100644
--- a/framework/inc/classes/framecontainer.hxx
+++ b/framework/inc/classes/framecontainer.hxx
@@ -27,8 +27,6 @@
#include <stdexcept>
#include <algorithm>
-#include <threadhelp/threadhelpbase.hxx>
-
#include <threadhelp/transactionbase.hxx>
#include <general.h>
@@ -54,13 +52,10 @@ typedef TFrameContainer::const_iterator TConstFrameI
It's possible to set one of these frames as active or deactive. You could have full index-access to
container-items.
- @base ThreadHelpBase
- guarantee right initialized lock member during boostrap!
-
@devstatus ready to use
@threadsafe yes
*//*-*************************************************************************************************************/
-class FrameContainer : private ThreadHelpBase
+class FrameContainer
{
// member
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index 505f5fb..863788a 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -23,6 +23,7 @@
#include <sal/config.h>
#include <classes/framecontainer.hxx>
+#include <threadhelp/threadhelpbase.hxx>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/frame/XController.hpp>
diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx
index 63fa123..32e52be 100644
--- a/framework/source/classes/framecontainer.cxx
+++ b/framework/source/classes/framecontainer.cxx
@@ -18,7 +18,6 @@
*/
#include <classes/framecontainer.hxx>
-#include <threadhelp/guard.hxx>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -33,9 +32,6 @@ namespace framework{
@threadsafe not necessary - its not a singleton
*****************************************************************************************************************/
FrameContainer::FrameContainer()
- // initialize base classes first.
- // Order is necessary for right initilization of his and OUR member ... m_aLock
- : ThreadHelpBase ( &Application::GetSolarMutex() )
/*DEPRECATEME
, m_bAsyncQuit ( sal_False ) // default must be "disabled"!
, m_aAsyncCall ( LINK( this, FrameContainer, implts_asyncQuit ) )
@@ -70,11 +66,8 @@ void FrameContainer::append( const css::uno::Reference< css::frame::XFrame >& xF
{
if (xFrame.is() && ! exist(xFrame))
{
- /* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
m_aContainer.push_back( xFrame );
- aWriteLock.unlock();
- /* } SAFE */
}
}
@@ -91,9 +84,7 @@ void FrameContainer::append( const css::uno::Reference< css::frame::XFrame >& xF
*****************************************************************************************************************/
void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xFrame )
{
- /* SAFE { */
- // write lock necessary for follwing erase()!
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
TFrameIterator aSearchedItem = ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame );
if (aSearchedItem!=m_aContainer.end())
@@ -104,9 +95,6 @@ void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xF
if (m_xActiveFrame==xFrame)
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
}
-
- aWriteLock.unlock();
- // } SAFE
}
/**-***************************************************************************************************************
@@ -123,10 +111,8 @@ void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xF
*****************************************************************************************************************/
sal_Bool FrameContainer::exist( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return( ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
- /* } SAFE */
}
/**-***************************************************************************************************************
@@ -137,18 +123,13 @@ sal_Bool FrameContainer::exist( const css::uno::Reference< css::frame::XFrame >&
*****************************************************************************************************************/
void FrameContainer::clear()
{
- // SAFE {
- Guard aWriteLock( m_aLock );
-
+ SolarMutexGuard g;
// Clear the container ...
m_aContainer.clear();
// ... and don't forget to reset the active frame.
// Its an reference to a valid container-item.
// But no container item => no active frame!
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
-
- aWriteLock.unlock();
- // } SAFE
}
/**-***************************************************************************************************************
@@ -164,10 +145,8 @@ void FrameContainer::clear()
*****************************************************************************************************************/
sal_uInt32 FrameContainer::getCount() const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return( (sal_uInt32)m_aContainer.size() );
- /* } SAFE */
}
/**-***************************************************************************************************************
@@ -192,11 +171,8 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::operator[]( sal_uInt32
{
// Get element form container WITH automatic test of ranges!
// If index not valid, a out_of_range exception is thrown.
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
xFrame = m_aContainer.at( nIndex );
- aReadLock.unlock();
- /* } SAFE */
}
catch( const std::out_of_range& )
{
@@ -217,17 +193,11 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::operator[]( sal_uInt32
*****************************************************************************************************************/
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > FrameContainer::getAllElements() const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
sal_Int32 nPosition = 0;
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lElements ( (sal_uInt32)m_aContainer.size() );
for (TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem)
lElements[nPosition++] = *pItem;
-
- aReadLock.unlock();
- /* } SAFE */
-
return lElements;
}
@@ -245,11 +215,8 @@ void FrameContainer::setActive( const css::uno::Reference< css::frame::XFrame >&
{
if ( !xFrame.is() || exist(xFrame) )
{
- /* SAFE { */
- Guard aWriteLock( m_aLock );
+ SolarMutexGuard g;
m_xActiveFrame = xFrame;
- aWriteLock.unlock();
- /* } SAFE */
}
}
@@ -265,10 +232,8 @@ void FrameContainer::setActive( const css::uno::Reference< css::frame::XFrame >&
*****************************************************************************************************************/
css::uno::Reference< css::frame::XFrame > FrameContainer::getActive() const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
+ SolarMutexGuard g;
return m_xActiveFrame;
- /* } SAFE */
}
/**-***************************************************************************************************************
@@ -284,9 +249,7 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::getActive() const
*****************************************************************************************************************/
css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens( const OUString& sName ) const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
// Step over all child frames. But if direct child isn't the right one search on his children first - before
// you go to next direct child of this container!
css::uno::Reference< css::frame::XFrame > xSearchedFrame;
@@ -304,8 +267,6 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens(
break;
}
}
- aReadLock.unlock();
- /* } SAFE */
return xSearchedFrame;
}
@@ -322,9 +283,7 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens(
*****************************************************************************************************************/
css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildrens( const OUString& sName ) const
{
- /* SAFE { */
- Guard aReadLock( m_aLock );
-
+ SolarMutexGuard g;
css::uno::Reference< css::frame::XFrame > xSearchedFrame;
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
{
@@ -334,8 +293,6 @@ css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildren
break;
}
}
- aReadLock.unlock();
- /* } SAFE */
return xSearchedFrame;
}
commit fd7479de09d0abdc06633b6610ad7a8e38dc7c6e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 08:30:34 2014 +0100
Remove unused ThreadHelpBase base
Change-Id: I1fb145bd660400ecc52be97fe0cefee3c03666f0
diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx
index 48e8516..86fa1cc 100644
--- a/framework/source/inc/accelerators/presethandler.hxx
+++ b/framework/source/inc/accelerators/presethandler.hxx
@@ -21,7 +21,6 @@
#define INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_PRESETHANDLER_HXX
#include <accelerators/storageholder.hxx>
-#include <threadhelp/threadhelpbase.hxx>
#include <general.h>
#include <stdtypes.h>
@@ -92,12 +91,10 @@ class PresetHandler
@descr This struct makes it possible to use any shared storage
in combination with a SingletonRef<> template ...
- Attention: Because these struct is shared it must be
- used within a synchronized section. Thats why this struct
- uses a base class ThreadHelpBase and can be locked
- from outside doing so!
+ This struct is allegedly shared and must be used within a
+ synchronized section. But it isn't.
*/
- struct TSharedStorages : public ThreadHelpBase
+ struct TSharedStorages
{
public:
commit 83408619a7f8ba6ba61e05e495d0520d8e8e1947
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 08:26:59 2014 +0100
Use SolarMutexGuard directly
Change-Id: I5fd051b77e52d98c4c2f14b1dda3b72efc4bdf49
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index 8071fae..8302086 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -22,7 +22,6 @@
#include <classes/fwkresid.hxx>
#include "classes/resource.hrc"
-#include <threadhelp/guard.hxx>
#include <services.h>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -86,8 +85,7 @@ OUString PresetHandler::RESOURCETYPE_STATUSBAR()
PresetHandler::PresetHandler(const css::uno::Reference< css::uno::XComponentContext >& xContext)
- : ThreadHelpBase (&Application::GetSolarMutex() )
- , m_xContext (xContext )
+ : m_xContext (xContext )
, m_aSharedStorages ( )
, m_lDocumentStorages()
, m_aLanguageTag (LANGUAGE_USER_PRIV_NOTRANSLATE)
@@ -96,8 +94,7 @@ PresetHandler::PresetHandler(const css::uno::Reference< css::uno::XComponentCont
PresetHandler::PresetHandler(const PresetHandler& rCopy)
- : ThreadHelpBase (&Application::GetSolarMutex() )
- , m_aLanguageTag( rCopy.m_aLanguageTag)
+ : m_aLanguageTag( rCopy.m_aLanguageTag)
{
m_xContext = rCopy.m_xContext;
m_eConfigType = rCopy.m_eConfigType;
@@ -145,8 +142,7 @@ PresetHandler::~PresetHandler()
void PresetHandler::forgetCachedStorages()
{
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
+ SolarMutexGuard g;
if (m_eConfigType == E_DOCUMENT)
{
@@ -156,9 +152,6 @@ void PresetHandler::forgetCachedStorages()
}
m_lDocumentStorages.forgetCachedStorages();
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
}
namespace {
@@ -208,11 +201,11 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
if (xRoot.is())
return xRoot;
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ {
+ SolarMutexGuard g;
+ xContext = m_xContext;
+ }
css::uno::Reference< css::util::XPathSettings > xPathSettings =
css::util::thePathSettings::get( xContext );
@@ -266,11 +259,11 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
if (xRoot.is())
return xRoot;
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ {
+ SolarMutexGuard g;
+ xContext = m_xContext;
+ }
css::uno::Reference< css::util::XPathSettings > xPathSettings =
css::util::thePathSettings::get( xContext );
@@ -310,29 +303,25 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
css::uno::Reference< css::embed::XStorage > PresetHandler::getWorkingStorageShare()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
return m_xWorkingStorageShare;
- // <- SAFE ----------------------------------
}
css::uno::Reference< css::embed::XStorage > PresetHandler::getWorkingStorageUser()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
return m_xWorkingStorageUser;
- // <- SAFE ----------------------------------
}
css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare(const css::uno::Reference< css::embed::XStorage >& /*xChild*/)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageShare;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::embed::XStorage > xWorking;
+ {
+ SolarMutexGuard g;
+ xWorking = m_xWorkingStorageShare;
+ }
return m_aSharedStorages->m_lStoragesShare.getParentStorage(xWorking);
}
@@ -340,11 +329,11 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare
css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser(const css::uno::Reference< css::embed::XStorage >& /*xChild*/)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageUser;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::embed::XStorage > xWorking;
+ {
+ SolarMutexGuard g;
+ xWorking = m_xWorkingStorageUser;
+ }
return m_aSharedStorages->m_lStoragesUser.getParentStorage(xWorking);
}
@@ -358,16 +347,13 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
{
// TODO free all current open storages!
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
-
- m_eConfigType = eConfigType ;
- m_sResourceType = sResource ;
- m_sModule = sModule ;
- m_aLanguageTag = rLanguageTag ;
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
+ {
+ SolarMutexGuard g;
+ m_eConfigType = eConfigType ;
+ m_sResourceType = sResource ;
+ m_sModule = sModule ;
+ m_aLanguageTag = rLanguageTag ;
+ }
css::uno::Reference< css::embed::XStorage > xShare;
css::uno::Reference< css::embed::XStorage > xNoLang;
@@ -532,20 +518,17 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
}
}
- // SAFE -> ----------------------------------
- aWriteLock.lock();
-
- m_xWorkingStorageShare = xShare ;
- m_xWorkingStorageNoLang= xNoLang;
- m_xWorkingStorageUser = xUser ;
- m_lPresets = lPresets;
- m_lTargets = lTargets;
- m_sRelPathShare = sRelPathShare;
- m_sRelPathNoLang = sRelPathNoLang;
- m_sRelPathUser = sRelPathUser;
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
+ {
+ SolarMutexGuard g;
+ m_xWorkingStorageShare = xShare ;
+ m_xWorkingStorageNoLang= xNoLang;
+ m_xWorkingStorageUser = xUser ;
+ m_lPresets = lPresets;
+ m_lTargets = lTargets;
+ m_sRelPathShare = sRelPathShare;
+ m_sRelPathNoLang = sRelPathNoLang;
+ m_sRelPathUser = sRelPathUser;
+ }
}
catch(const css::uno::Exception&)
@@ -563,13 +546,15 @@ void PresetHandler::copyPresetToTarget(const OUString& sPreset,
// dont check our preset list, if element exists
// We try to open it and forward all errors to the user!
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::embed::XStorage > xWorkingShare = m_xWorkingStorageShare;
- css::uno::Reference< css::embed::XStorage > xWorkingNoLang= m_xWorkingStorageNoLang;
- css::uno::Reference< css::embed::XStorage > xWorkingUser = m_xWorkingStorageUser ;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::embed::XStorage > xWorkingShare;
+ css::uno::Reference< css::embed::XStorage > xWorkingNoLang;
+ css::uno::Reference< css::embed::XStorage > xWorkingUser;
+ {
+ SolarMutexGuard g;
+ xWorkingShare = m_xWorkingStorageShare;
+ xWorkingNoLang= m_xWorkingStorageNoLang;
+ xWorkingUser = m_xWorkingStorageUser ;
+ }
// e.g. module without any config data ?!
if (
@@ -603,11 +588,11 @@ void PresetHandler::copyPresetToTarget(const OUString& sPreset,
css::uno::Reference< css::io::XStream > PresetHandler::openPreset(const OUString& sPreset,
sal_Bool bUseNoLangGlobal)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::embed::XStorage > xFolder = bUseNoLangGlobal? m_xWorkingStorageNoLang: m_xWorkingStorageShare;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::embed::XStorage > xFolder;
+ {
+ SolarMutexGuard g;
+ xFolder = bUseNoLangGlobal? m_xWorkingStorageNoLang: m_xWorkingStorageShare;
+ }
// e.g. module without any config data ?!
if (!xFolder.is())
@@ -625,11 +610,11 @@ css::uno::Reference< css::io::XStream > PresetHandler::openPreset(const OUString
css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const OUString& sTarget ,
sal_Bool bCreateIfMissing)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::embed::XStorage > xFolder = m_xWorkingStorageUser;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::embed::XStorage > xFolder;
+ {
+ SolarMutexGuard g;
+ xFolder = m_xWorkingStorageUser;
+ }
// e.g. module without any config data ?!
if (!xFolder.is())
@@ -665,12 +650,13 @@ css::uno::Reference< css::io::XStream > PresetHandler::openTarget(const OUString
void PresetHandler::commitUserChanges()
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- css::uno::Reference< css::embed::XStorage > xWorking = m_xWorkingStorageUser;
- EConfigType eCfgType = m_eConfigType;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::embed::XStorage > xWorking;
+ EConfigType eCfgType;
+ {
+ SolarMutexGuard g;
+ xWorking = m_xWorkingStorageUser;
+ eCfgType = m_eConfigType;
+ }
// e.g. module without any config data ?!
if (!xWorking.is())
@@ -702,12 +688,13 @@ void PresetHandler::commitUserChanges()
void PresetHandler::addStorageListener(IStorageListener* pListener)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- OUString sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer!
- EConfigType eCfgType = m_eConfigType;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ OUString sRelPath;
+ EConfigType eCfgType;
+ {
+ SolarMutexGuard g;
+ sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer!
+ eCfgType = m_eConfigType;
+ }
if (sRelPath.isEmpty())
return;
@@ -732,12 +719,13 @@ void PresetHandler::addStorageListener(IStorageListener* pListener)
void PresetHandler::removeStorageListener(IStorageListener* pListener)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
- OUString sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer!
- EConfigType eCfgType = m_eConfigType;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ OUString sRelPath;
+ EConfigType eCfgType;
+ {
+ SolarMutexGuard g;
+ sRelPath = m_sRelPathUser; // use user path ... because we dont work directly on the share layer!
+ eCfgType = m_eConfigType;
+ }
if (sRelPath.isEmpty())
return;
diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx
index 1ca54f7..48e8516 100644
--- a/framework/source/inc/accelerators/presethandler.hxx
+++ b/framework/source/inc/accelerators/presethandler.hxx
@@ -50,7 +50,7 @@ namespace framework
"menubar" "default" "menubar"
*/
-class PresetHandler : private ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
+class PresetHandler
{
commit fbc72e5feb88b80ff335298d275627ed3a6a75df
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 18 08:16:40 2014 +0100
Use SolarMutexGuard directly
Change-Id: I6ca88538be5400714fcbe880776ac30cca3d68ae
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 8e58eb8..815196e 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -25,8 +25,6 @@
#include <xml/acceleratorconfigurationreader.hxx>
#include <xml/acceleratorconfigurationwriter.hxx>
-#include <threadhelp/guard.hxx>
-
#include <acceleratorconst.h>
#include <services.h>
@@ -541,8 +539,7 @@ OUString XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext)
- : ThreadHelpBase (&Application::GetSolarMutex())
- , m_xContext (xContext )
+ : m_xContext (xContext )
, m_pPrimaryWriteCache(0 )
, m_pSecondaryWriteCache(0 )
{
@@ -561,8 +558,7 @@ XCUBasedAcceleratorConfiguration::~XCUBasedAcceleratorConfiguration()
css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getAllKeyEvents()
throw(css::uno::RuntimeException, std::exception)
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set
@@ -574,8 +570,6 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
lKeys.push_back(*pIt);
return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
}
@@ -583,8 +577,7 @@ OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const c
throw(css::container::NoSuchElementException,
css::uno::RuntimeException, std::exception )
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
@@ -598,8 +591,6 @@ OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const c
return rPrimaryCache.getCommandByKey(aKeyEvent);
else
return rSecondaryCache.getCommandByKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
}
@@ -627,8 +618,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyE
static_cast< ::cppu::OWeakObject* >(this),
1);
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
+ SolarMutexGuard g;
AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); // sal_True => force getting of a writeable cache!
AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); // sal_True => force getting of a writeable cache!
@@ -684,9 +674,6 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyE
rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
}
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
}
@@ -694,8 +681,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::K
throw(css::container::NoSuchElementException,
css::uno::RuntimeException, std::exception )
{
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
+ SolarMutexGuard g;
AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
@@ -728,8 +714,6 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::K
if (!sDelCommand.isEmpty())
rSecondaryCache.removeKey(aKeyEvent);
}
-
- // <- SAFE ----------------------------------
}
@@ -744,8 +728,7 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
static_cast< ::cppu::OWeakObject* >(this),
1);
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
@@ -763,8 +746,6 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
lKeys.push_back(*pIt);
return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
}
@@ -791,8 +772,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g
throw(css::lang::IllegalArgumentException ,
css::uno::RuntimeException, std::exception )
{
- // SAFE -> ----------------------------------
- Guard aReadLock(m_aLock);
+ SolarMutexGuard g;
sal_Int32 i = 0;
sal_Int32 c = lCommandList.getLength();
@@ -823,9 +803,6 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g
}
}
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
return lPreferredOnes;
}
@@ -841,8 +818,7 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(co
static_cast< ::cppu::OWeakObject* >(this),
0);
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
+ SolarMutexGuard g;
AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list