From 6c49b4290955ef1b3a502b4e5e223a4fd5573683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 25 Feb 2022 12:22:16 +0100 Subject: [PATCH] make sure that LOK "updated types" start a timer as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- desktop/inc/lib/init.hxx | 1 + desktop/source/lib/init.cxx | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) 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 queue_type1; typedef std::vector queue_type2; + void startTimer(); bool removeAll(int type); bool removeAll(int type, const std::function& 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;