summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-07-01 12:14:37 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-02 07:17:51 +0000
commit68956354b57bb7f42fe91f969d4953c578cb496b (patch)
tree5d78cf6efdfcbc5779f90ef962a00ebc1d903f3f
parentfc53b5cb942726a878f4950509e42eb9b312017a (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 (cherry picked from commit 49a454225e35699d7351faaba3d296e1858c6107) Reviewed-on: https://gerrit.libreoffice.org/4650 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx14
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: */