From 3895c2e7c8b32bfde74e2dc391c6c195aae22fc7 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 24 Oct 2011 12:58:23 +0200 Subject: fdo#42157: fix deadlock WindowStateGuard_Impl::impl_ensureEnabledState_nothrow_nolck: drop own mutex while calling XWindow method that locks SolarMutex. --- forms/source/helper/windowstateguard.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'forms/source') diff --git a/forms/source/helper/windowstateguard.cxx b/forms/source/helper/windowstateguard.cxx index 7a947ecf30fb..2cfae615f4de 100644 --- a/forms/source/helper/windowstateguard.cxx +++ b/forms/source/helper/windowstateguard.cxx @@ -135,18 +135,21 @@ namespace frm try { Reference< XWindow2 > xWindow; - sal_Bool bEnabled = sal_False; + Reference< XPropertySet > xModelProps; sal_Bool bShouldBeEnabled = 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 ); + xModelProps = m_xModelProps; } + // fdo#42157: do not lock m_aMutex to prevent deadlock + bool const bEnabled = xWindow->isEnabled(); + OSL_VERIFY( xModelProps->getPropertyValue( PROPERTY_ENABLED ) + >>= bShouldBeEnabled ); - if ( !bShouldBeEnabled && bEnabled && xWindow.is() ) + if ( !bShouldBeEnabled && bEnabled ) xWindow->setEnable( sal_False ); } catch( const Exception& ) -- cgit