[Libreoffice-commits] core.git: ucb/source

Michael Stahl mstahl at redhat.com
Mon Jul 1 03:23:17 PDT 2013


 ucb/source/ucp/webdav-neon/webdavcontent.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 49a454225e35699d7351faaba3d296e1858c6107
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 1 12:14:37 2013 +0200

    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

diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 4ad76c4..49e8655 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: */


More information about the Libreoffice-commits mailing list