[Libreoffice-commits] online.git: loolwsd/ChildSession.hpp loolwsd/LOOLKit.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Aug 22 05:05:14 UTC 2016


 loolwsd/ChildSession.hpp |    2 --
 loolwsd/LOOLKit.cpp      |    4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 59b88dab495126fbce00a859eca64536d2fb264c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Aug 20 08:27:42 2016 -0400

    loolwsd: don't expose ChildSession mutex publicly
    
    The only usecases for using the ChildSession mutex
    are during tile rendering in Document. For these
    the lok::Document mutex is perfectly fine.
    
    Change-Id: I888e51d7885b05081858bcd55212abe45925e732
    Reviewed-on: https://gerrit.libreoffice.org/28295
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index 61cac9d..e69c415 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -67,8 +67,6 @@ public:
 
     void loKitCallback(const int nType, const std::string& rPayload);
 
-    static std::unique_lock<std::recursive_mutex> getLock() { return std::unique_lock<std::recursive_mutex>(Mutex); }
-
 private:
     bool loadDocument(const char *buffer, int length, Poco::StringTokenizer& tokens);
 
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 8123c7b..f21268b 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -619,13 +619,13 @@ public:
         std::vector<unsigned char> pixmap;
         pixmap.resize(output.capacity());
 
-        std::unique_lock<std::recursive_mutex> lock(ChildSession::getLock());
         if (!_loKitDocument)
         {
             Log::error("Tile rendering requested before loading document.");
             return;
         }
 
+        std::unique_lock<std::mutex> lock(_loKitDocument->getLock());
         if (_loKitDocument->getViews() <= 0)
         {
             Log::error("Tile rendering requested without views.");
@@ -694,13 +694,13 @@ public:
         const size_t pixmapSize = 4 * pixmapWidth * pixmapHeight;
         std::vector<unsigned char> pixmap(pixmapSize, 0);
 
-        std::unique_lock<std::recursive_mutex> lock(ChildSession::getLock());
         if (!_loKitDocument)
         {
             Log::error("Tile rendering requested before loading document.");
             return;
         }
 
+        std::unique_lock<std::mutex> lock(_loKitDocument->getLock());
         Timestamp timestamp;
         _loKitDocument->paintPartTile(pixmap.data(), tileCombined.getPart(),
                                       pixmapWidth, pixmapHeight,


More information about the Libreoffice-commits mailing list