diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-09-03 17:26:50 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-09-03 17:26:50 +0200 |
commit | 6a8fd4c76a969ac98d1aff91ff7442f43aee0006 (patch) | |
tree | 5b5541fec946c60764bc49aafd23a293c0426fb5 /toolkit | |
parent | 2b1b6c16040dc4c25b3143872f39fed6b9e6b54d (diff) |
dba33i: #163542# VCLXWindow::OnProcessCallbacks: process window events while attempting to re-acquire the solar mutex - this prevents deadlocks with other threads trying to SendMessage into the main thread
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/toolkit/helper/solarrelease.hxx | 27 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindow.cxx | 3 |
2 files changed, 26 insertions, 4 deletions
diff --git a/toolkit/inc/toolkit/helper/solarrelease.hxx b/toolkit/inc/toolkit/helper/solarrelease.hxx index d8938b41c220..e45a1b6ee2c3 100644 --- a/toolkit/inc/toolkit/helper/solarrelease.hxx +++ b/toolkit/inc/toolkit/helper/solarrelease.hxx @@ -41,15 +41,36 @@ namespace toolkit class ReleaseSolarMutex { sal_uInt32 mnLockCount; + const bool mbRescheduleDuringAcquire; + public: - ReleaseSolarMutex() + enum { - mnLockCount = Application::ReleaseSolarMutex(); + RescheduleDuringAcquire = true + }; + + public: + ReleaseSolarMutex( const bool i_rescheduleDuringAcquire = false ) + :mnLockCount( Application::ReleaseSolarMutex() ) + ,mbRescheduleDuringAcquire( i_rescheduleDuringAcquire ) + { + } ~ReleaseSolarMutex() { - Application::AcquireSolarMutex( mnLockCount ); + if ( mnLockCount > 0 ) + { + if ( mbRescheduleDuringAcquire ) + { + while ( !Application::GetSolarMutex().tryToAcquire() ) + { + Application::Reschedule(); + } + --mnLockCount; + } + Application::AcquireSolarMutex( mnLockCount ); + } } }; diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index efc2c40c6baa..1022d78a43ed 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -92,6 +92,7 @@ using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE; namespace WritingMode2 = ::com::sun::star::text::WritingMode2; namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; +using ::toolkit::ReleaseSolarMutex; //==================================================================== //= misc helpers @@ -339,7 +340,7 @@ IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG ) } { - ::toolkit::ReleaseSolarMutex aReleaseSolar; + ReleaseSolarMutex aReleaseSolar( ReleaseSolarMutex::RescheduleDuringAcquire ); for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin(); loop != aCallbacksCopy.end(); ++loop |