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

Pranav Kant pranavk at collabora.com
Fri May 6 11:08:50 UTC 2016


 loolwsd/LOOLKit.cpp |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 27497ba4dcd363f060b6dcce7f2672e926566fa8
Author: Pranav Kant <pranavk at collabora.com>
Date:   Fri May 6 14:47:04 2016 +0530

    loolwsd: Fix tile previews for viewing sessions
    
    Also, don't let these tile previews change part of the document
    permanently. This is a temporary solution till we have some
    better API from LOKit to deal with such a situation.
    
    Change-Id: I8dfefd2b7ad8cf3e7a57afb95b57994ef0bb3b6c

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 3d80548..60b3e02 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -659,10 +659,10 @@ public:
 
         std::vector<unsigned char> pixmap;
         pixmap.resize(4 * width * height);
-
-        if (part != _loKitDocument->pClass->getPart(_loKitDocument))
+        int oldPart = _loKitDocument->pClass->getPart(_loKitDocument);
+        if (part != oldPart)
         {
-            if (editLock)
+            if (editLock || id != -1)
             {
                 _loKitDocument->pClass->setPart(_loKitDocument, part);
             }
@@ -689,6 +689,12 @@ public:
             return;
         }
 
+        // restore the original part if tilepreview request changed the part
+        if (id != -1)
+        {
+            _loKitDocument->pClass->setPart(_loKitDocument, oldPart);
+        }
+
         const auto length = output.size();
         if (length > SMALL_MESSAGE_SIZE)
         {


More information about the Libreoffice-commits mailing list