Kaydet (Commit) 956d088d authored tarafından Matúš Kukan's avatar Matúš Kukan

fdo#72157: webdav: Release WebDAV file lock on document close.

Make it work with both serf and neon version.

Change-Id: I3c74ba57cde19f4417d0229c1c809756e3c5f9f8
üst 46b6721c
...@@ -112,6 +112,7 @@ Content::Content( ...@@ -112,6 +112,7 @@ Content::Content(
m_eResourceType( UNKNOWN ), m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ), m_pProvider( pProvider ),
m_bTransient( false ), m_bTransient( false ),
m_bLocked( false ),
m_bCollection( false ), m_bCollection( false ),
m_bDidGetOrHead( false ) m_bDidGetOrHead( false )
{ {
...@@ -144,6 +145,7 @@ Content::Content( ...@@ -144,6 +145,7 @@ Content::Content(
m_eResourceType( UNKNOWN ), m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ), m_pProvider( pProvider ),
m_bTransient( true ), m_bTransient( true ),
m_bLocked( false ),
m_bCollection( isCollection ), m_bCollection( isCollection ),
m_bDidGetOrHead( false ) m_bDidGetOrHead( false )
{ {
...@@ -164,6 +166,8 @@ Content::Content( ...@@ -164,6 +166,8 @@ Content::Content(
// virtual // virtual
Content::~Content() Content::~Content()
{ {
if (m_bLocked)
unlock(uno::Reference< ucb::XCommandEnvironment >());
} }
...@@ -2820,6 +2824,7 @@ void Content::lock( ...@@ -2820,6 +2824,7 @@ void Content::lock(
uno::Sequence< OUString >() ); uno::Sequence< OUString >() );
xResAccess->LOCK( aLock, Environment ); xResAccess->LOCK( aLock, Environment );
m_bLocked = true;
{ {
osl::Guard< osl::Mutex > aGuard( m_aMutex ); osl::Guard< osl::Mutex > aGuard( m_aMutex );
...@@ -2849,6 +2854,7 @@ void Content::unlock( ...@@ -2849,6 +2854,7 @@ void Content::unlock(
} }
xResAccess->UNLOCK( Environment ); xResAccess->UNLOCK( Environment );
m_bLocked = false;
{ {
osl::Guard< osl::Mutex > aGuard( m_aMutex ); osl::Guard< osl::Mutex > aGuard( m_aMutex );
......
...@@ -91,6 +91,7 @@ class Content : public ::ucbhelper::ContentImplHelper, ...@@ -91,6 +91,7 @@ class Content : public ::ucbhelper::ContentImplHelper,
ResourceType m_eResourceType; ResourceType m_eResourceType;
ContentProvider* m_pProvider; // No need for a ref, base class holds object ContentProvider* m_pProvider; // No need for a ref, base class holds object
bool m_bTransient; bool m_bTransient;
bool m_bLocked;
bool m_bCollection; bool m_bCollection;
bool m_bDidGetOrHead; bool m_bDidGetOrHead;
std::vector< OUString > m_aFailedPropNames; std::vector< OUString > m_aFailedPropNames;
......
...@@ -1103,6 +1103,7 @@ void SerfSession::UNLOCK( const OUString & inPath, ...@@ -1103,6 +1103,7 @@ void SerfSession::UNLOCK( const OUString & inPath,
{ {
HandleError( aReqProc ); HandleError( aReqProc );
SAL_INFO("ucb.ucp.webdav", "UNLOCK of " << inPath << " succeeded." ); SAL_INFO("ucb.ucp.webdav", "UNLOCK of " << inPath << " succeeded." );
apr_environment::AprEnv::getAprEnv()->getSerfLockStore()->removeLock( inPath );
} }
catch(...) catch(...)
{ {
......
...@@ -207,6 +207,7 @@ Content::Content( ...@@ -207,6 +207,7 @@ Content::Content(
m_eResourceType( UNKNOWN ), m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ), m_pProvider( pProvider ),
m_bTransient( false ), m_bTransient( false ),
m_bLocked( false ),
m_bCollection( false ), m_bCollection( false ),
m_bDidGetOrHead( false ) m_bDidGetOrHead( false )
{ {
...@@ -239,6 +240,7 @@ Content::Content( ...@@ -239,6 +240,7 @@ Content::Content(
m_eResourceType( UNKNOWN ), m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ), m_pProvider( pProvider ),
m_bTransient( true ), m_bTransient( true ),
m_bLocked( false ),
m_bCollection( isCollection ), m_bCollection( isCollection ),
m_bDidGetOrHead( false ) m_bDidGetOrHead( false )
{ {
...@@ -259,6 +261,8 @@ Content::Content( ...@@ -259,6 +261,8 @@ Content::Content(
// virtual // virtual
Content::~Content() Content::~Content()
{ {
if (m_bLocked)
unlock(uno::Reference< ucb::XCommandEnvironment >());
} }
...@@ -2944,6 +2948,7 @@ void Content::lock( ...@@ -2944,6 +2948,7 @@ void Content::lock(
uno::Sequence< OUString >() ); uno::Sequence< OUString >() );
xResAccess->LOCK( aLock, Environment ); xResAccess->LOCK( aLock, Environment );
m_bLocked = true;
{ {
osl::Guard< osl::Mutex > aGuard( m_aMutex ); osl::Guard< osl::Mutex > aGuard( m_aMutex );
...@@ -2971,6 +2976,7 @@ void Content::unlock( ...@@ -2971,6 +2976,7 @@ void Content::unlock(
} }
xResAccess->UNLOCK( Environment ); xResAccess->UNLOCK( Environment );
m_bLocked = false;
{ {
osl::Guard< osl::Mutex > aGuard( m_aMutex ); osl::Guard< osl::Mutex > aGuard( m_aMutex );
......
...@@ -82,6 +82,7 @@ class Content : public ::ucbhelper::ContentImplHelper, ...@@ -82,6 +82,7 @@ class Content : public ::ucbhelper::ContentImplHelper,
ResourceType m_eResourceType; ResourceType m_eResourceType;
ContentProvider* m_pProvider; // No need for a ref, base class holds object ContentProvider* m_pProvider; // No need for a ref, base class holds object
bool m_bTransient; bool m_bTransient;
bool m_bLocked;
bool m_bCollection; bool m_bCollection;
bool m_bDidGetOrHead; bool m_bDidGetOrHead;
std::vector< OUString > m_aFailedPropNames; std::vector< OUString > m_aFailedPropNames;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment