[Libreoffice-commits] core.git: sw/inc sw/source

Jan-Marek Glogowski glogow at fbihome.de
Thu Jul 20 08:28:08 UTC 2017


 sw/inc/SwDocIdle.hxx                             |    2 +-
 sw/source/core/doc/DocumentStatisticsManager.cxx |   11 +++++------
 sw/source/core/doc/DocumentTimerManager.cxx      |    8 +++++++-
 3 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit d7a2fd3e8262b8897ad06f01f25f46330e050e0c
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Jul 18 19:55:01 2017 +0200

    tdf#109123 Change SwDocIdle base class to Idle
    
    This hides SwDocIdle from SalInstance::AnyInput( VCL_INPUT_ANY )
    on Windows. Otherwise Writer assumes there is more stuff to do, as
    it can't know the scheduled Windows event is just for itself,
    resulting in a busy loop, which freezes Writer.
    
    Change-Id: I919c40e8e1673eb09a69a3084203d1c4a6ecac8a
    Reviewed-on: https://gerrit.libreoffice.org/40189
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/sw/inc/SwDocIdle.hxx b/sw/inc/SwDocIdle.hxx
index 6bc65e24766c..f20fabd44f98 100644
--- a/sw/inc/SwDocIdle.hxx
+++ b/sw/inc/SwDocIdle.hxx
@@ -32,7 +32,7 @@ namespace sw {
  * quite probably not a problem, as busy documents have a high chance to have
  * generated idle tasks.
  */
-class SwDocIdle : public AutoIdle
+class SwDocIdle : public Idle
 {
 private:
     SwDoc &m_rDoc;
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index 9d050e0c77a0..c3bd626e21e6 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -127,11 +127,10 @@ void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields
             while (IncrementalDocStatCalculate(
                         std::numeric_limits<long>::max(), bFields)) {}
         }
+        else if (IncrementalDocStatCalculate(5000, bFields))
+            maStatsUpdateIdle.Start();
         else
-        {
-            if (!maStatsUpdateIdle.IsActive() && IncrementalDocStatCalculate(5000, bFields))
-                maStatsUpdateIdle.Start();
-        }
+            maStatsUpdateIdle.Stop();
     }
 }
 
@@ -239,8 +238,8 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
 
 IMPL_LINK( DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pIdle, void )
 {
-    if (!IncrementalDocStatCalculate(32000))
-        pIdle->Stop();
+    if (IncrementalDocStatCalculate(32000))
+        pIdle->Start();
     SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
     if( pView )
         pView->UpdateDocStats();
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index 4a9855570bd6..ec4874ea9ecc 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -96,7 +96,10 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
         for(SwViewShell& rSh : pShell->GetRingContainer())
         {
             if( rSh.ActionPend() )
+            {
+                pIdle->Start();
                 return;
+            }
         }
 
         if( pTmpRoot->IsNeedGrammarCheck() )
@@ -117,6 +120,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
             {
                 (*pLayIter)->GetCurrShell()->LayoutIdle();
                 // Defer the remaining work.
+                pIdle->Start();
                 return;
             }
         }
@@ -131,7 +135,10 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
         {
             if ( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields() ||
                       m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
+            {
+                pIdle->Start();
                 return;
+            }
 
             //  Action brackets!
             m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( true );
@@ -159,7 +166,6 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void )
     if( pModLogFile && 1 != (long)pModLogFile )
         delete pModLogFile, static_cast<long&>(pModLogFile) = 1;
 #endif
-    pIdle->Stop();
 }
 
 DocumentTimerManager::~DocumentTimerManager() {}


More information about the Libreoffice-commits mailing list