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

New commits:
commit 6c49b4290955ef1b3a502b4e5e223a4fd5573683
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Feb 25 12:22:16 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Fri Feb 25 14:41:25 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/+/130526
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 288fa8ebfcc0..6132a7a302cc 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -177,6 +177,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 processInvalidateTilesEvent(int type, CallbackData& 
aCallbackData);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0dd274b58f59..b5db7f8cb1e6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1392,6 +1392,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 )
@@ -1406,6 +1408,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 )
@@ -1730,12 +1734,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)
@@ -2218,6 +2217,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