[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp

Jan Holesovsky kendy at collabora.com
Mon May 9 09:43:29 UTC 2016


 loolwsd/LOOLWSD.cpp |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit f041c3ffc04e4e27631d287a5ada55ef3eac658a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon May 9 11:41:37 2016 +0200

    Scope the lock to avoid warnings.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index d089501..6aee539 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -525,18 +525,22 @@ private:
         const auto uriPublic = DocumentBroker::sanitizeURI(uri);
         const auto docKey = DocumentBroker::getDocKey(uriPublic);
         std::shared_ptr<DocumentBroker> docBroker;
-        std::unique_lock<std::mutex> docBrokersLock(docBrokersMutex);
 
-        // Lookup this document.
-        auto it = docBrokers.find(docKey);
-        if (it != docBrokers.end())
+        // scope the docBrokersLock
         {
-            // Get the DocumentBroker from the Cache.
-            Log::debug("Found DocumentBroker for docKey [" + docKey + "].");
-            docBroker = it->second;
-            assert(docBroker);
+            std::unique_lock<std::mutex> docBrokersLock(docBrokersMutex);
+
+            // Lookup this document.
+            auto it = docBrokers.find(docKey);
+            if (it != docBrokers.end())
+            {
+                // Get the DocumentBroker from the Cache.
+                Log::debug("Found DocumentBroker for docKey [" + docKey + "].");
+                docBroker = it->second;
+                assert(docBroker);
+            }
+            docBrokersLock.unlock();
         }
-        docBrokersLock.unlock();
 
         if (docBroker)
         {


More information about the Libreoffice-commits mailing list