[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-2' - include/svtools svtools/source

Tomofumi Yagi (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 28 17:40:03 UTC 2020


 include/svtools/filechangedchecker.hxx     |    2 +-
 svtools/source/misc/filechangedchecker.cxx |   21 ++++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit d62fe22aed6acf36c5321a417beb4c37a5f715a2
Author:     Tomofumi Yagi <yagitmknada at gmail.com>
AuthorDate: Fri Sep 18 16:21:43 2020 +0900
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Sep 28 19:39:30 2020 +0200

    tdf#134157 fix Edit with external tool causes a CPU hit
    
    Switch Idle to 100ms Timer for fixing the bug
    
    Change-Id: I85a9bdcb173edd28d952d8e91c1b93d748e69206
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102984
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit f110c037114f90d219ac8d149542bf96fe66a2f1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103055
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 1d28170d94893171e2a358274cda62cd73f7b834)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103059
    Reviewed-by: Tomofumi Yagi <yagit at mknada.sakura.ne.jp>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Tested-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/include/svtools/filechangedchecker.hxx b/include/svtools/filechangedchecker.hxx
index 3b7f817f3035..016fe9279800 100644
--- a/include/svtools/filechangedchecker.hxx
+++ b/include/svtools/filechangedchecker.hxx
@@ -29,7 +29,7 @@ class Timer;
 class UNLESS_MERGELIBS(SVT_DLLPUBLIC) FileChangedChecker
 {
 private:
-    Idle                    mIdle;
+    Timer                    mTimer;
     OUString                 mFileName;
     TimeValue                mLastModTime;
     ::std::function<void ()> mpCallback;
diff --git a/svtools/source/misc/filechangedchecker.cxx b/svtools/source/misc/filechangedchecker.cxx
index 09e24c3fafb1..8536eb0bda57 100644
--- a/svtools/source/misc/filechangedchecker.cxx
+++ b/svtools/source/misc/filechangedchecker.cxx
@@ -16,7 +16,7 @@
 
 FileChangedChecker::FileChangedChecker(const OUString& rFilename,
         const ::std::function<void ()>& rCallback)
-    : mIdle("SVTools FileChangedChecker Idle")
+    : mTimer("SVTools FileChangedChecker Timer")
     , mFileName(rFilename)
     , mLastModTime()
     , mpCallback(rCallback)
@@ -24,21 +24,24 @@ FileChangedChecker::FileChangedChecker(const OUString& rFilename,
     // Get the curren last file modified Status
     getCurrentModTime(mLastModTime);
 
-    // associate the callback function for the Idle
-    mIdle.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
+    // associate the callback function for the Timer
+    mTimer.SetInvokeHandler(LINK(this, FileChangedChecker, TimerHandler));
 
-    //start the timer
+    // set timer interval
+    mTimer.SetTimeout(100);
+
+    // start the timer
     resetTimer();
 }
 
 void FileChangedChecker::resetTimer()
 {
-    //Start the Idle if it's not active
-    if(!mIdle.IsActive())
-        mIdle.Start();
+    // Start the Idle if it's not active
+    if(!mTimer.IsActive())
+        mTimer.Start();
 
     // Set lowest Priority
-    mIdle.SetPriority(TaskPriority::LOWEST);
+    mTimer.SetPriority(TaskPriority::LOWEST);
 }
 
 bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const
@@ -90,7 +93,7 @@ IMPL_LINK_NOARG(FileChangedChecker, TimerHandler, Timer *, void)
         mpCallback();
     }
 
-    // Reset the Idle in any case
+    // Reset the Timer in any case
     resetTimer();
 }
 


More information about the Libreoffice-commits mailing list