diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-06-20 14:37:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-20 14:44:05 +0200 |
commit | bd91d9319efb7fcf0e5861e66ab5ea9e5630bf3f (patch) | |
tree | 048aad7c32257b55932b99898ecf93475eb040f3 /desktop/source/app | |
parent | 97beabccb73321a8d2e022705afa755f15e99fa0 (diff) |
Avoid deadlock when signal handler joins thread
...as the signal can potentially be delivered to the to-be-joined thread. (It
is unclear to me whether the SalMainPipeExchangeSingal_impl handler is really
needed anyway, as there are various other places that should ensure that
DisableOfficeIPCThread is called during shutdown. At least in theory, no longer
joining here can cause the thread to incur crashes etc. when it it still running
during shutdown.)
Change-Id: I677a2e31e1a58d2b8d91634c2eb5274d63ac15f4
Diffstat (limited to 'desktop/source/app')
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 9 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.hxx | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index e99eb1d20eac..d90aa27a771b 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -297,7 +297,7 @@ void ImplPostProcessDocumentsEvent( ProcessDocumentsRequest* pEvent ) oslSignalAction SAL_CALL SalMainPipeExchangeSignal_impl(void* /*pData*/, oslSignalInfo* pInfo) { if( pInfo->Signal == osl_Signal_Terminate ) - OfficeIPCThread::DisableOfficeIPCThread(); + OfficeIPCThread::DisableOfficeIPCThread(false); return osl_Signal_ActCallNextHdl; } @@ -575,7 +575,7 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() return IPC_STATUS_OK; } -void OfficeIPCThread::DisableOfficeIPCThread() +void OfficeIPCThread::DisableOfficeIPCThread(bool join) { osl::ClearableMutexGuard aMutex( GetMutex() ); @@ -604,7 +604,10 @@ void OfficeIPCThread::DisableOfficeIPCThread() OfficeIPCThread::SetReady(pOfficeIPCThread); // exit gracefully and join - pOfficeIPCThread->join(); + if (join) + { + pOfficeIPCThread->join(); + } } } diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index f60a134add53..5dc03bc71d8c 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -128,7 +128,7 @@ class OfficeIPCThread : public salhelper::Thread // return sal_False if second office static Status EnableOfficeIPCThread(); - static void DisableOfficeIPCThread(); + static void DisableOfficeIPCThread(bool join = true); // start dispatching events... static void SetReady( rtl::Reference< OfficeIPCThread > const & pThread = |