From 7cc2bb414c0ac42556cc5b11b8dbdad630927d78 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 18 Mar 2014 14:52:35 +0100 Subject: Use SolarMutexGuard directly Change-Id: I58d52cfec21f2f93a6a17469bf31fc70d93c26a9 --- framework/inc/helper/titlebarupdate.hxx | 6 +---- framework/source/helper/titlebarupdate.cxx | 41 ++++++++++-------------------- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/framework/inc/helper/titlebarupdate.hxx b/framework/inc/helper/titlebarupdate.hxx index 75e01193b697..d45082d4ccfc 100644 --- a/framework/inc/helper/titlebarupdate.hxx +++ b/framework/inc/helper/titlebarupdate.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX #define INCLUDED_FRAMEWORK_INC_HELPER_TITLEBARUPDATE_HXX -#include #include #include #include @@ -43,10 +42,7 @@ namespace framework{ @devstatus draft @threadsafe yes *//*-*************************************************************************************************************/ -class TitleBarUpdate : // baseclasses (order necessary for right initialization!) - private ThreadHelpBase - // interfaces - , public ::cppu::WeakImplHelper3< +class TitleBarUpdate : public ::cppu::WeakImplHelper3< css::lang::XInitialization , css::frame::XTitleChangeListener // => XEventListener , css::frame::XFrameActionListener > // => XEventListener diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 1805872aa5cd..9450fd23cc98 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -54,8 +53,7 @@ static const ::sal_Int32 DEFAULT_ICON_ID = 0; TitleBarUpdate::TitleBarUpdate(const css::uno::Reference< css::uno::XComponentContext >& xContext) - : ThreadHelpBase (&Application::GetSolarMutex()) - , m_xContext (xContext ) + : m_xContext (xContext ) , m_xFrame ( ) { } @@ -85,12 +83,11 @@ void SAL_CALL TitleBarUpdate::initialize(const css::uno::Sequence< css::uno::Any static_cast< ::cppu::OWeakObject* >(this), 1); - // SYNCHRONIZED -> - Guard aWriteLock(m_aLock); - // hold the frame as weak reference(!) so it can die everytimes :-) - m_xFrame = xFrame; - aWriteLock.unlock(); - // <- SYNCHRONIZED + { + SolarMutexGuard g; + // hold the frame as weak reference(!) so it can die everytimes :-) + m_xFrame = xFrame; + } // start listening xFrame->addFrameActionListener(this); @@ -144,14 +141,8 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr #if !defined(MACOSX) try { - // SYNCHRONIZED -> - Guard aReadLock(m_aLock); - css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); - // <- SYNCHRONIZED - css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = - css::frame::ModuleManager::create( xContext ); + css::frame::ModuleManager::create( m_xContext ); OUString sDesktopName; OUString aModuleId = xModuleManager->identify(xFrame); @@ -215,16 +206,10 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr if ( ! xFrame.is ()) return sal_False; - // SYNCHRONIZED -> - Guard aReadLock(m_aLock); - css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aReadLock.unlock(); - // <- SYNCHRONIZED - try { css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = - css::frame::ModuleManager::create( xContext ); + css::frame::ModuleManager::create( m_xContext ); rInfo.sID = xModuleManager->identify(xFrame); ::comphelper::SequenceAsHashMap lProps = xModuleManager->getByName (rInfo.sID); @@ -246,11 +231,11 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr void TitleBarUpdate::impl_forceUpdate() { - // SYNCHRONIZED -> - Guard aReadLock(m_aLock); - css::uno::Reference< css::frame::XFrame > xFrame(m_xFrame.get(), css::uno::UNO_QUERY); - aReadLock.unlock(); - // <- SYNCHRONIZED + css::uno::Reference< css::frame::XFrame > xFrame; + { + SolarMutexGuard g; + xFrame.set(m_xFrame.get(), css::uno::UNO_QUERY); + } // frame already gone ? We hold it weak only ... if ( ! xFrame.is()) -- cgit v1.2.3