[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - ucb/source

Matúš Kukan matus.kukan at collabora.com
Tue Jun 24 16:04:23 PDT 2014


 ucb/source/ucp/webdav-neon/webdavcontent.cxx |    6 ++++++
 ucb/source/ucp/webdav-neon/webdavcontent.hxx |    1 +
 ucb/source/ucp/webdav/SerfSession.cxx        |    1 +
 ucb/source/ucp/webdav/webdavcontent.cxx      |    6 ++++++
 ucb/source/ucp/webdav/webdavcontent.hxx      |    1 +
 5 files changed, 15 insertions(+)

New commits:
commit 8b0b55adb3196d1833146497b01da2c0e7c45e87
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Jun 24 16:22:51 2014 +0200

    fdo#72157: webdav: Release WebDAV file lock on document close.
    
    Make it work with both serf and neon version.
    
    Change-Id: I3c74ba57cde19f4417d0229c1c809756e3c5f9f8
    (cherry picked from commit 956d088db5850e9a096bb9abd8b3e446e096f613)
    Reviewed-on: https://gerrit.libreoffice.org/9880
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index ff1b86c..a5ffa0d 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -112,6 +112,7 @@ Content::Content(
   m_eResourceType( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( false ),
+  m_bLocked( false ),
   m_bCollection( false ),
   m_bDidGetOrHead( false )
 {
@@ -144,6 +145,7 @@ Content::Content(
   m_eResourceType( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( true ),
+  m_bLocked( false ),
   m_bCollection( isCollection ),
   m_bDidGetOrHead( false )
 {
@@ -164,6 +166,8 @@ Content::Content(
 // virtual
 Content::~Content()
 {
+    if (m_bLocked)
+        unlock(uno::Reference< ucb::XCommandEnvironment >());
 }
 
 
@@ -2818,6 +2822,7 @@ void Content::lock(
             uno::Sequence< OUString >() );
 
         xResAccess->LOCK( aLock, Environment );
+        m_bLocked = true;
 
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -2847,6 +2852,7 @@ void Content::unlock(
         }
 
         xResAccess->UNLOCK( Environment );
+        m_bLocked = false;
 
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 7e9c851..8073c1f 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -91,6 +91,7 @@ class Content : public ::ucbhelper::ContentImplHelper,
     ResourceType      m_eResourceType;
     ContentProvider*  m_pProvider; // No need for a ref, base class holds object
     bool              m_bTransient;
+    bool              m_bLocked;
     bool              m_bCollection;
     bool              m_bDidGetOrHead;
     std::vector< OUString > m_aFailedPropNames;
diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx
index eea9644..a33b0a9 100644
--- a/ucb/source/ucp/webdav/SerfSession.cxx
+++ b/ucb/source/ucp/webdav/SerfSession.cxx
@@ -1103,6 +1103,7 @@ void SerfSession::UNLOCK( const OUString & inPath,
     {
         HandleError( aReqProc );
         SAL_INFO("ucb.ucp.webdav",  "UNLOCK of " << inPath << " succeeded." );
+        apr_environment::AprEnv::getAprEnv()->getSerfLockStore()->removeLock( inPath );
     }
     catch(...)
     {
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index cf1a55e6..cd416cc 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -207,6 +207,7 @@ Content::Content(
   m_eResourceType( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( false ),
+  m_bLocked( false ),
   m_bCollection( false ),
   m_bDidGetOrHead( false )
 {
@@ -239,6 +240,7 @@ Content::Content(
   m_eResourceType( UNKNOWN ),
   m_pProvider( pProvider ),
   m_bTransient( true ),
+  m_bLocked( false ),
   m_bCollection( isCollection ),
   m_bDidGetOrHead( false )
 {
@@ -259,6 +261,8 @@ Content::Content(
 // virtual
 Content::~Content()
 {
+    if (m_bLocked)
+        unlock(uno::Reference< ucb::XCommandEnvironment >());
 }
 
 
@@ -2946,6 +2950,7 @@ void Content::lock(
             uno::Sequence< OUString >() );
 
         xResAccess->LOCK( aLock, Environment );
+        m_bLocked = true;
 
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -2973,6 +2978,7 @@ void Content::unlock(
         }
 
         xResAccess->UNLOCK( Environment );
+        m_bLocked = false;
 
         {
             osl::Guard< osl::Mutex > aGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx
index f9daf3d..daa948c 100644
--- a/ucb/source/ucp/webdav/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav/webdavcontent.hxx
@@ -82,6 +82,7 @@ class Content : public ::ucbhelper::ContentImplHelper,
     ResourceType      m_eResourceType;
     ContentProvider*  m_pProvider; // No need for a ref, base class holds object
     bool              m_bTransient;
+    bool              m_bLocked;
     bool              m_bCollection;
     bool              m_bDidGetOrHead;
     std::vector< OUString > m_aFailedPropNames;


More information about the Libreoffice-commits mailing list