[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - kit/ChildSession.cpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 15 09:00:18 UTC 2020


 kit/ChildSession.cpp |   29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

New commits:
commit 956c17afe9d5e33f53fd8d107e8384520e23d862
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jan 6 17:52:57 2020 -0500
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Jan 15 09:59:59 2020 +0100

    wsd: handle rectangle=undefined gracefully
    
    Change-Id: Ib9058956143aae8151c5e76fddff5dea313ff5e7
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86323
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit ad0256259bd8634cbd06b3ff5e881961f384023e)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86360

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index da16d807f..ea7d26cd2 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1263,25 +1263,30 @@ bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const st
     int bufferWidth = 800, bufferHeight = 600;
     double dpiScale = 1.0;
     std::string paintRectangle;
-    if (tokens.size() > 2 && getTokenString(tokens[2], "rectangle", paintRectangle))
+    if (tokens.size() > 2 && getTokenString(tokens[2], "rectangle", paintRectangle)
+        && paintRectangle != "undefined")
     {
-        const std::vector<std::string> rectParts = LOOLProtocol::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
-        startX = std::atoi(rectParts[0].c_str());
-        startY = std::atoi(rectParts[1].c_str());
-        bufferWidth = std::atoi(rectParts[2].c_str());
-        bufferHeight = std::atoi(rectParts[3].c_str());
-
-        std::string dpiScaleString;
-        if (tokens.size() > 3 && getTokenString(tokens[3], "dpiscale", dpiScaleString))
+        const std::vector<std::string> rectParts
+            = LOOLProtocol::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
+        if (rectParts.size() == 4)
         {
-            dpiScale = std::stod(dpiScaleString);
-            if (dpiScale < 0.001)
-                dpiScale = 1.0;
+            startX = std::atoi(rectParts[0].c_str());
+            startY = std::atoi(rectParts[1].c_str());
+            bufferWidth = std::atoi(rectParts[2].c_str());
+            bufferHeight = std::atoi(rectParts[3].c_str());
         }
     }
     else
         LOG_WRN("windowpaint command doesn't specify a rectangle= attribute.");
 
+    std::string dpiScaleString;
+    if (tokens.size() > 3 && getTokenString(tokens[3], "dpiscale", dpiScaleString))
+    {
+        dpiScale = std::stod(dpiScaleString);
+        if (dpiScale < 0.001)
+            dpiScale = 1.0;
+    }
+
     size_t pixmapDataSize = 4 * bufferWidth * bufferHeight;
     std::vector<unsigned char> pixmap(pixmapDataSize);
     int width = bufferWidth, height = bufferHeight;


More information about the Libreoffice-commits mailing list