desktop/inc/lib/init.hxx    |    1 +
 desktop/source/lib/init.cxx |   19 +++++++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit f509da33f2b63be957bb4897c1bb20db1d3fc2a2
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Feb 25 12:22:16 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Feb 28 15:03:54 2022 +0100

    make sure that LOK "updated types" start a timer as well
    
    273a25c796fca9afa0dfadac57dc3f336831221c changed the handling of LOK
    messages to only set up an "updated" flag for types and then
    when flushing the value is fetched. This means that queue() is not
    called for such updates, and so the timeout to flush the messages
    wasn't started.
    
    Change-Id: I3a7324c86a55697f509f80b6c54cb949fb1daa72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130459
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index b2ba47239f2f..c19e4c5b0ac1 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -175,6 +175,7 @@ namespace desktop {
         typedef std::vector<int> queue_type1;
         typedef std::vector<CallbackData> queue_type2;
 
+        void startTimer();
         bool removeAll(int type);
         bool removeAll(int type, const std::function<bool (const 
CallbackData&)>& rTestFunc);
         bool removeAll(const std::function<bool (int, const CallbackData&)>& 
rTestFunc);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2ae5fc89f731..ca65ec4ae2ca 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1402,6 +1402,8 @@ void CallbackFlushHandler::setUpdatedType( int nType, 
bool value )
     if( m_updatedTypes.size() <= o3tl::make_unsigned( nType ))
         m_updatedTypes.resize( nType + 1 ); // new are default-constructed, 
i.e. false
     m_updatedTypes[ nType ] = value;
+    if(value)
+        startTimer();
 }
 
 void CallbackFlushHandler::resetUpdatedType( int nType )
@@ -1416,6 +1418,8 @@ void CallbackFlushHandler::setUpdatedTypePerViewId( int 
nType, int nViewId, int
     if( types.size() <= o3tl::make_unsigned( nType ))
         types.resize( nType + 1 ); // new are default-constructed, i.e. 'set' 
is false
     types[ nType ] = PerViewIdData{ value, nSourceViewId };
+    if(value)
+        startTimer();
 }
 
 void CallbackFlushHandler::resetUpdatedTypePerViewId( int nType, int nViewId )
@@ -1745,12 +1749,7 @@ void CallbackFlushHandler::queue(const int type, 
CallbackData& aCallbackData)
 #endif
 
     lock.unlock();
-    if (!IsActive())
-    {
-        Start();
-    }
-    if (!m_TimeoutIdle.IsActive())
-        m_TimeoutIdle.Start();
+    startTimer();
 }
 
 bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& 
aCallbackData)
@@ -2234,6 +2233,14 @@ void CallbackFlushHandler::Invoke()
     m_TimeoutIdle.Stop();
 }
 
+void CallbackFlushHandler::startTimer()
+{
+    if (!IsActive())
+        Start();
+    if (!m_TimeoutIdle.IsActive())
+        m_TimeoutIdle.Start();
+}
+
 bool CallbackFlushHandler::removeAll(int type)
 {
     bool bErased = false;

Reply via email to