summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-06-24 16:22:51 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-24 23:04:17 +0000
commitde5de7e1116fad18c8e3eef110eb32f2c75550ca (patch)
tree98506ef383b1f41812a44cdcf83faba9cc93f1bb
parent87a3fe36ecc3a036806f1ca660c68debc763937d (diff)
fdo#72157: webdav: Release WebDAV file lock on document close.
Only neon version is relevant in this branch (libreoffice-4-2). (cherry picked from commit 956d088db5850e9a096bb9abd8b3e446e096f613) Conflicts: ucb/source/ucp/webdav/SerfSession.cxx Change-Id: I3c74ba57cde19f4417d0229c1c809756e3c5f9f8 Reviewed-on: https://gerrit.libreoffice.org/9881 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.hxx1
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.cxx6
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.hxx1
4 files changed, 14 insertions, 0 deletions
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index bff41ad5520b..ce2fcbbc538f 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 f2d378b657ab..ee46d6d66db1 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/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index d98c39ba0708..941bef6b013f 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -208,6 +208,7 @@ Content::Content(
m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ),
m_bTransient( false ),
+ m_bLocked( false ),
m_bCollection( false ),
m_bDidGetOrHead( false )
{
@@ -240,6 +241,7 @@ Content::Content(
m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ),
m_bTransient( true ),
+ m_bLocked( false ),
m_bCollection( isCollection ),
m_bDidGetOrHead( false )
{
@@ -260,6 +262,8 @@ Content::Content(
// virtual
Content::~Content()
{
+ if (m_bLocked)
+ unlock(uno::Reference< ucb::XCommandEnvironment >());
}
//=========================================================================
@@ -2983,6 +2987,7 @@ void Content::lock(
uno::Sequence< OUString >() );
xResAccess->LOCK( aLock, Environment );
+ m_bLocked = true;
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -3010,6 +3015,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 10c3022dba8e..a301983c6221 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;