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

New commits:
commit a81e47aca7e7d21276f73be2859c85d3ea98b9b9
Author:     Luboš Luňák <[email protected]>
AuthorDate: Fri Feb 25 12:22:16 2022 +0100
Commit:     Luboš Luňák <[email protected]>
CommitDate: Mon Feb 28 19:06:20 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/+/130460
    Tested-by: Luboš Luňák <[email protected]>
    Reviewed-by: Luboš Luňák <[email protected]>

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 91a4d80ca128..9720a7a78967 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1397,6 +1397,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 )
@@ -1411,6 +1413,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 )
@@ -1735,12 +1739,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)
@@ -2223,6 +2222,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