Kaydet (Commit) 2822d189 authored tarafından Caolán McNamara's avatar Caolán McNamara

valgrind: use after free

sal/osl/unx/conditn.cxx:90: pthread_cond_destroy failed: Device or resource busy
sal/osl/unx/conditn.cxx:92: pthread_mutex_destroy failed: Device or resource busy

"Desktop disposed before terminating it"

seen under valgrind with CppunitTest_sccomp_lpsolver

Change-Id: I643cf114b902c38a6a54487fd78c55d84ed78cfc
üst 8488b3ba
...@@ -106,9 +106,9 @@ private: ...@@ -106,9 +106,9 @@ private:
std::unique_ptr< InitUpdateCheckJobThread > m_pInitThread; std::unique_ptr< InitUpdateCheckJobThread > m_pInitThread;
void handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp ); void handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp );
void terminateAndJoinThread();
}; };
InitUpdateCheckJobThread::InitUpdateCheckJobThread( InitUpdateCheckJobThread::InitUpdateCheckJobThread(
const uno::Reference< uno::XComponentContext > &xContext, const uno::Reference< uno::XComponentContext > &xContext,
const uno::Sequence< beans::NamedValue > &xParameters, const uno::Sequence< beans::NamedValue > &xParameters,
...@@ -155,7 +155,6 @@ UpdateCheckJob::~UpdateCheckJob() ...@@ -155,7 +155,6 @@ UpdateCheckJob::~UpdateCheckJob()
{ {
} }
uno::Sequence< OUString > uno::Sequence< OUString >
UpdateCheckJob::getServiceNames() UpdateCheckJob::getServiceNames()
{ {
...@@ -281,6 +280,7 @@ void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt ) ...@@ -281,6 +280,7 @@ void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt )
if ( shutDown && m_xDesktop.is() ) if ( shutDown && m_xDesktop.is() )
{ {
terminateAndJoinThread();
m_xDesktop->removeTerminateListener( this ); m_xDesktop->removeTerminateListener( this );
m_xDesktop.clear(); m_xDesktop.clear();
} }
...@@ -293,19 +293,23 @@ void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & ) ...@@ -293,19 +293,23 @@ void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & )
{ {
} }
void UpdateCheckJob::terminateAndJoinThread()
void SAL_CALL UpdateCheckJob::notifyTermination( lang::EventObject const & )
throw ( uno::RuntimeException, std::exception )
{ {
if ( m_pInitThread.get() != nullptr ) if ( m_pInitThread.get() != nullptr )
{ {
m_pInitThread->setTerminating(); m_pInitThread->setTerminating();
m_pInitThread->join(); m_pInitThread->join();
m_pInitThread.reset();
} }
} }
} // anonymous namespace void SAL_CALL UpdateCheckJob::notifyTermination( lang::EventObject const & )
throw ( uno::RuntimeException, std::exception )
{
terminateAndJoinThread();
}
} // anonymous namespace
static uno::Reference<uno::XInterface> SAL_CALL static uno::Reference<uno::XInterface> SAL_CALL
createJobInstance(const uno::Reference<uno::XComponentContext>& xContext) createJobInstance(const uno::Reference<uno::XComponentContext>& xContext)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment