diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-09-03 19:37:30 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-09-03 19:37:30 +0200 |
commit | 43c935a92579f312bbad57651be1429b267ca37d (patch) | |
tree | d3095ac4209760ba939f483e8d05bccbf8ca1b3a /forms/source/helper/windowstateguard.cxx | |
parent | merged in latest changes from CWS dba33i (diff) | |
download | core-43c935a92579f312bbad57651be1429b267ca37d.tar.gz core-43c935a92579f312bbad57651be1429b267ca37d.zip |
dba34a: i113188# don't call into XWindow implementations with own mutex locked
Diffstat (limited to 'forms/source/helper/windowstateguard.cxx')
-rw-r--r-- | forms/source/helper/windowstateguard.cxx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/forms/source/helper/windowstateguard.cxx b/forms/source/helper/windowstateguard.cxx index c4bb6154a4d5..1bbc8e4242f6 100644 --- a/forms/source/helper/windowstateguard.cxx +++ b/forms/source/helper/windowstateguard.cxx @@ -98,7 +98,7 @@ namespace frm @precond our mutex is locked */ - void impl_ensureEnabledState_nothrow() const; + void impl_ensureEnabledState_nothrow_nolck(); }; //-------------------------------------------------------------------- @@ -129,16 +129,24 @@ namespace frm } //-------------------------------------------------------------------- - void WindowStateGuard_Impl::impl_ensureEnabledState_nothrow() const + void WindowStateGuard_Impl::impl_ensureEnabledState_nothrow_nolck() { try { - sal_Bool bEnabled = m_xWindow->isEnabled(); + Reference< XWindow2 > xWindow; + sal_Bool bEnabled = sal_False; sal_Bool bShouldBeEnabled = sal_False; - OSL_VERIFY( m_xModelProps->getPropertyValue( PROPERTY_ENABLED ) >>= bShouldBeEnabled ); - - if ( !bShouldBeEnabled && bEnabled ) - m_xWindow->setEnable( sal_False ); + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xWindow.is() || !m_xModelProps.is() ) + return; + xWindow = m_xWindow; + bEnabled = xWindow->isEnabled(); + OSL_VERIFY( m_xModelProps->getPropertyValue( PROPERTY_ENABLED ) >>= bShouldBeEnabled ); + } + + if ( !bShouldBeEnabled && bEnabled && xWindow.is() ) + xWindow->setEnable( sal_False ); } catch( const Exception& ) { @@ -149,15 +157,13 @@ namespace frm //-------------------------------------------------------------------- void SAL_CALL WindowStateGuard_Impl::windowEnabled( const EventObject& /*e*/ ) throw (RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_ensureEnabledState_nothrow(); + impl_ensureEnabledState_nothrow_nolck(); } //-------------------------------------------------------------------- void SAL_CALL WindowStateGuard_Impl::windowDisabled( const EventObject& /*e*/ ) throw (RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - impl_ensureEnabledState_nothrow(); + impl_ensureEnabledState_nothrow_nolck(); } //-------------------------------------------------------------------- |