diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-07-01 12:14:37 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-07-01 12:20:45 +0200 |
commit | 49a454225e35699d7351faaba3d296e1858c6107 (patch) | |
tree | 16a2efdd57682da62f3c5f9b627a95fa8abda60f /ucb | |
parent | 8be462fde98a8f22f182b5b3e63657f7007ed165 (diff) |
fdo#66324 fix locking in webdav_ucp::Content::getResourceType()
Crash in there while accessing an evidently deleted DAVResourceAccess
instance with about 4 other threads also in various webdav_ucp::Content
methods.
The problem is apparently that the "outer" getResourceType() passes the
m_xResAccess to the "inner" getResourceType(), which accesses it
without locking the mutex, while another thread resets m_xResAccess
and thereby deletes the current instance.
(regression from 0c3500115c4fd86284a027fc32be704afcf77061)
Change-Id: I1c67021c536e303d766c7ff93fb71e40f991f3af
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 4ad76c4727e2..49e8655e1116 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -3164,7 +3164,19 @@ Content::ResourceType Content::getResourceType( const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw ( uno::Exception ) { - return getResourceType( xEnv, m_xResAccess ); + SAL_WNODEPRECATED_DECLARATIONS_PUSH + std::auto_ptr< DAVResourceAccess > xResAccess; + SAL_WNODEPRECATED_DECLARATIONS_POP + { + osl::MutexGuard aGuard( m_aMutex ); + xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); + } + Content::ResourceType const ret = getResourceType( xEnv, xResAccess ); + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); + } + return ret; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |