[Libreoffice-commits] core.git: desktop/inc desktop/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 22 14:39:50 UTC 2019


 desktop/inc/lib/init.hxx    |    2 ++
 desktop/source/lib/init.cxx |   15 +++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 5f978a3b8d2cdab29aef4544dfb66ad755dfdc3f
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Feb 15 09:23:58 2019 -0500
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Fri Feb 22 15:39:09 2019 +0100

    LOK: always update the payload string via the cache
    
    Change-Id: I090ceb7d214d0809e86b023a8806b6655627918a
    Reviewed-on: https://gerrit.libreoffice.org/67894
    Tested-by: Jenkins
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index be96814820ce..2ba5595d8b46 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -102,6 +102,8 @@ namespace desktop {
 
             /// Parse and set the RectangleAndPart object and return it. Clobbers PayloadString.
             RectangleAndPart& setRectangleAndPart(const std::string& payload);
+            /// Set a RectangleAndPart object and update PayloadString.
+            void setRectangleAndPart(const RectangleAndPart& rRectAndPart);
             /// Return the parsed RectangleAndPart instance.
             const RectangleAndPart& getRectangleAndPart() const;
             /// Parse and set the JSON object and return it. Clobbers PayloadString.
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c4edf05e16dc..bf36321fc9a0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -456,12 +456,18 @@ RectangleAndPart RectangleAndPart::Create(const std::string& rPayload)
 
 RectangleAndPart& CallbackFlushHandler::CallbackData::setRectangleAndPart(const std::string& payload)
 {
-    PayloadString = payload;
+    setRectangleAndPart(RectangleAndPart::Create(payload));
 
-    PayloadObject = RectangleAndPart::Create(payload);
+    // Return reference to the cached object.
     return boost::get<RectangleAndPart>(PayloadObject);
 }
 
+void CallbackFlushHandler::CallbackData::setRectangleAndPart(const RectangleAndPart& rRectAndPart)
+{
+    PayloadString = rRectAndPart.toString().getStr();
+    PayloadObject = rRectAndPart;
+}
+
 const RectangleAndPart& CallbackFlushHandler::CallbackData::getRectangleAndPart() const
 {
     assert(PayloadObject.which() == 1);
@@ -477,6 +483,7 @@ boost::property_tree::ptree& CallbackFlushHandler::CallbackData::setJson(const s
     // Let boost normalize the payload so it always matches the cache.
     setJson(aTree);
 
+    // Return reference to the cached object.
     return boost::get<boost::property_tree::ptree>(PayloadObject);
 }
 
@@ -913,7 +920,7 @@ void CallbackFlushHandler::callback(const int type, const char* payload, void* d
 void CallbackFlushHandler::queue(const int type, const char* data)
 {
     CallbackData aCallbackData(type, (data ? data : "(nil)"));
-    std::string& payload = aCallbackData.PayloadString;
+    const std::string& payload = aCallbackData.PayloadString;
     SAL_INFO("lok", "Queue: " << type << " : " << payload);
 
 #ifdef DBG_UTIL
@@ -1202,7 +1209,7 @@ void CallbackFlushHandler::queue(const int type, const char* data)
                     }
                 }
 
-                payload = rcNew.toString().getStr();
+                aCallbackData.setRectangleAndPart(rcNew);
             }
             break;
 


More information about the Libreoffice-commits mailing list