[Libreoffice-commits] core.git: vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 21 06:54:27 UTC 2021


 vcl/jsdialog/jsdialogbuilder.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit e64784c4e8775d0c831ad71c70e73854a4b9aaa4
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 20 17:48:18 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jan 21 07:53:42 2021 +0100

    jsdialog: don't send multiple updates with the same content
    
    Change-Id: I601511a85386a8a35cbc6a121a4719928f585794
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109726
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e8c8ff4d4232..836c73f3edea 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -68,6 +68,18 @@ void JSDialogNotifyIdle::send(tools::JsonWriter& aJsonWriter)
 
 void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, VclPtr<vcl::Window> pWindow)
 {
+    // we want only the latest update of same type
+    // TODO: also if we met full update - previous updates are not valid
+    auto it = m_aMessageQueue.begin();
+
+    while (it != m_aMessageQueue.end())
+    {
+        if (it->first == eType && it->second == pWindow)
+            it = m_aMessageQueue.erase(it);
+        else
+            it++;
+    }
+
     m_aMessageQueue.push_back(std::make_pair(eType, pWindow));
 }
 


More information about the Libreoffice-commits mailing list