summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-18 14:46:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-18 15:27:07 +0100
commit90cee97bc98ea82cbbc3985b1ae68cb19088a734 (patch)
tree9a9e3963e3fe448874721e4631d29c821db975cf
parent503d893847fe8076340cf6a9de73a06892bc2660 (diff)
Use SolarMutexGuard directly
Change-Id: Id9828f95673d1eaf87e6a1c22bf8f07e6861f2f4
-rw-r--r--framework/inc/helper/persistentwindowstate.hxx9
-rw-r--r--framework/source/helper/persistentwindowstate.cxx35
2 files changed, 16 insertions, 28 deletions
diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx
index f6926d83bf18..ce4d354b800a 100644
--- a/framework/inc/helper/persistentwindowstate.hxx
+++ b/framework/inc/helper/persistentwindowstate.hxx
@@ -20,7 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_INC_HELPER_PERSISTENTWINDOWSTATE_HXX
#define INCLUDED_FRAMEWORK_INC_HELPER_PERSISTENTWINDOWSTATE_HXX
-#include <threadhelp/threadhelpbase.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <general.h>
@@ -47,19 +46,13 @@ namespace framework{
we store its current position and size to the configuration. Every time a new component is
attached to a frame first time(!) we restore this information again.
- @base ThreadHelpBase
- guarantee right initialized lock member during startup of instances of this class.
-
@base OWeakObject
implements ref counting for this class.
@devstatus ready
@threadsafe yes
*//*-*************************************************************************************************************/
-class PersistentWindowState : // baseclasses (order necessary for right initialization!)
- private ThreadHelpBase,
- // interfaces
- public ::cppu::WeakImplHelper2<
+class PersistentWindowState : public ::cppu::WeakImplHelper2<
css::lang::XInitialization,
css::frame::XFrameActionListener > // => XEventListener
{
diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx
index 0b3782377880..a542484e7095 100644
--- a/framework/source/helper/persistentwindowstate.cxx
+++ b/framework/source/helper/persistentwindowstate.cxx
@@ -19,7 +19,6 @@
#include <pattern/window.hxx>
#include <helper/persistentwindowstate.hxx>
-#include <threadhelp/guard.hxx>
#include <macros/generic.hxx>
#include <services.h>
@@ -45,8 +44,7 @@ namespace framework{
PersistentWindowState::PersistentWindowState(const css::uno::Reference< css::uno::XComponentContext >& xContext)
- : ThreadHelpBase (&Application::GetSolarMutex())
- , m_xContext (xContext )
+ : m_xContext (xContext )
, m_bWindowStateAlreadySet(sal_False )
{
}
@@ -76,12 +74,10 @@ void SAL_CALL PersistentWindowState::initialize(const css::uno::Sequence< css::u
static_cast< ::cppu::OWeakObject* >(this),
1);
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
- // hold the frame as weak reference(!) so it can die everytimes :-)
- m_xFrame = xFrame;
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
+ {
+ SolarMutexGuard g;
+ m_xFrame = xFrame;
+ }
// start listening
xFrame->addFrameActionListener(this);
@@ -91,13 +87,15 @@ void SAL_CALL PersistentWindowState::initialize(const css::uno::Sequence< css::u
void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEvent& aEvent)
throw(css::uno::RuntimeException, std::exception)
{
- // 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);
- sal_Bool bRestoreWindowState = !m_bWindowStateAlreadySet;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
+ css::uno::Reference< css::uno::XComponentContext > xContext;
+ css::uno::Reference< css::frame::XFrame > xFrame;
+ sal_Bool bRestoreWindowState;
+ {
+ SolarMutexGuard g;
+ xContext = m_xContext;
+ xFrame.set(m_xFrame.get(), css::uno::UNO_QUERY);
+ bRestoreWindowState = !m_bWindowStateAlreadySet;
+ }
// frame already gone ? We hold it weak only ...
if (!xFrame.is())
@@ -121,11 +119,8 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv
{
OUString sWindowState = PersistentWindowState::implst_getWindowStateFromConfig(xContext, sModuleName);
PersistentWindowState::implst_setWindowStateOnWindow(xWindow,sWindowState);
- // SAFE -> ----------------------------------
- Guard aWriteLock(m_aLock);
+ SolarMutexGuard g;
m_bWindowStateAlreadySet = sal_True;
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
}
}
break;