ucb/source/ucp/webdav-neon/NeonLockStore.cxx |   13 ++++++++++++-
 ucb/source/ucp/webdav-neon/NeonLockStore.hxx |    2 ++
 ucb/source/ucp/webdav-neon/NeonSession.cxx   |    1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 94e4695bcfcb9356d37942c47359b94531ef7b95
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jul 8 23:47:12 2019 +1000
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jul 8 23:56:50 2019 +0200

    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.kagan...@collabora.com>

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 cd8b31f9d359..ed0d43723d05 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -1679,6 +1679,7 @@ bool NeonSession::LOCK( NeonLock * pLock,
         {
             // tdf#126279: see handling of NE_AUTH in HandleError
             m_bNeedNewSession = true;
+            m_aNeonLockStore.removeLockDeferred(pLock);
         }
         return false;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to