diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-08-28 10:13:28 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-08-28 13:13:12 +0200 |
commit | 771544544ee13ec98961f93b5313a7d2e29429cd (patch) | |
tree | 8ace179c45335afc2d3daf1b87d1ba120d5e5dea /sw | |
parent | e82785887a13bdb8d8cd4d4c74df0c6c71ae52d4 (diff) |
tdf#119458 fix sw background Idle unblocking
We can't handle the correct state when blocking via a tasks
mbActive bool, as this also schedules the task and starts the
scheduler timer. So reintroduce a bool for the unblock state.
Change-Id: I40991d0160b058fae3803fab002dc036fc0b0339
Reviewed-on: https://gerrit.libreoffice.org/59692
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentTimerManager.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentTimerManager.hxx | 1 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index 6195b8fdf961..81c46b125840 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -39,6 +39,7 @@ namespace sw DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ), m_nIdleBlockCount( 0 ), + m_bStartOnUnblock( false ), m_aDocIdle( i_rSwdoc ) { m_aDocIdle.SetPriority(TaskPriority::LOWEST); @@ -48,18 +49,26 @@ DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc void DocumentTimerManager::StartIdling() { - if (!m_aDocIdle.IsActive()) + if (m_nIdleBlockCount > 0) + m_bStartOnUnblock = true; + else if (!m_aDocIdle.IsActive()) m_aDocIdle.Start(); } void DocumentTimerManager::StopIdling() { + m_bStartOnUnblock = false; m_aDocIdle.Stop(); } void DocumentTimerManager::BlockIdling() { assert(SAL_MAX_UINT32 != m_nIdleBlockCount); + if (0 == m_nIdleBlockCount) + { + assert(!m_bStartOnUnblock); + m_bStartOnUnblock = false; + } ++m_nIdleBlockCount; } @@ -68,9 +77,13 @@ void DocumentTimerManager::UnblockIdling() assert(0 != m_nIdleBlockCount); --m_nIdleBlockCount; - // kick the active idle, if it's not anymore blocked by IsDocIdle() - if (m_aDocIdle.IsActive() && IsDocIdle()) - m_aDocIdle.Start(); + if ((0 == m_nIdleBlockCount) && m_bStartOnUnblock) + { + m_bStartOnUnblock = false; + // kick the active idle, if it's not anymore blocked by IsDocIdle() + if (IsDocIdle()) + m_aDocIdle.Start(); + } } DocumentTimerManager::IdleJob DocumentTimerManager::GetNextIdleJob() const diff --git a/sw/source/core/inc/DocumentTimerManager.hxx b/sw/source/core/inc/DocumentTimerManager.hxx index e04e0602cc4f..2caaf608c40d 100644 --- a/sw/source/core/inc/DocumentTimerManager.hxx +++ b/sw/source/core/inc/DocumentTimerManager.hxx @@ -67,6 +67,7 @@ private: SwDoc& m_rDoc; sal_uInt32 m_nIdleBlockCount; ///< Don't run the Idle, if > 0 + bool m_bStartOnUnblock; ///< true, if the last unblock should start the timer SwDocIdle m_aDocIdle; }; |