diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-07-08 23:47:12 +1000 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-07-11 13:12:23 +0200 |
commit | d0af88819e9b569f7b2584921e910422b8aaff9e (patch) | |
tree | 510ac63c769e25ec88d80803c90e7a35a188c8c8 /ucb | |
parent | c8b91cc5356d670a3b0a7ca0efaccb56b7125bb5 (diff) |
tdf#126279 related: remove locks from NeonLockStore after NE_AUTH error
Change-Id: Idbbb9bb215e3a56e72a29f798c5a5f84afaf2213
Reviewed-on: https://gerrit.libreoffice.org/75224
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 94e4695bcfcb9356d37942c47359b94531ef7b95)
Reviewed-on: https://gerrit.libreoffice.org/75407
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonLockStore.cxx | 13 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonLockStore.hxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonSession.cxx | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx index 13b24f7b665d..8ac218915a4d 100644 --- a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx +++ b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx @@ -151,7 +151,7 @@ void NeonLockStore::stopTicker(osl::ClearableMutexGuard & rGuard) rGuard.clear(); - if (pTickerThread.is()) + if (pTickerThread.is() && pTickerThread->getIdentifier() != osl::Thread::getCurrentIdentifier()) pTickerThread->join(); // without m_aMutex locked (to prevent deadlock) } @@ -196,6 +196,13 @@ void NeonLockStore::removeLock( NeonLock * pLock ) stopTicker(aGuard); } +void NeonLockStore::removeLockDeferred(NeonLock* pLock) +{ + osl::MutexGuard aGuard(m_aMutex); + + m_aRemoveDeferred.push_back(pLock); +} + void NeonLockStore::refreshLocks() { osl::MutexGuard aGuard( m_aMutex ); @@ -228,6 +235,10 @@ void NeonLockStore::refreshLocks() } } } + // removeLock will not need to actually release the lock, because this is run from TickerThread + for (auto pLock : m_aRemoveDeferred) + removeLock(pLock); + m_aRemoveDeferred.clear(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/webdav-neon/NeonLockStore.hxx b/ucb/source/ucp/webdav-neon/NeonLockStore.hxx index 0cee2063fd31..86fccb68a50f 100644 --- a/ucb/source/ucp/webdav-neon/NeonLockStore.hxx +++ b/ucb/source/ucp/webdav-neon/NeonLockStore.hxx @@ -66,6 +66,7 @@ class NeonLockStore ne_lock_store * const m_pNeonLockStore; rtl::Reference< TickerThread > m_pTickerThread; LockInfoMap m_aLockInfoMap; + std::vector<NeonLock*> m_aRemoveDeferred; public: NeonLockStore(); @@ -82,6 +83,7 @@ public: sal_Int32 nLastChanceToSendRefreshRequest ); void removeLock( NeonLock * pLock ); + void removeLockDeferred(NeonLock* pLock); void refreshLocks(); diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index d4dab49ae37e..e5ab416c84ba 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -1682,6 +1682,7 @@ bool NeonSession::LOCK( NeonLock * pLock, { // tdf#126279: see handling of NE_AUTH in HandleError m_bNeedNewSession = true; + m_aNeonLockStore.removeLockDeferred(pLock); } return false; } |