sc/source/core/data/documen3.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a5471b6146b99e0b19c382914676b54bf339dbcf
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Aug 17 12:12:01 2025 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Mon Aug 18 15:34:28 2025 +0200

    sc: use FlagRestorationGuard instead of manually setting idle flag
    
    Change-Id: I5cb42e562aec04ec2226324a69ebd30697a55e91
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189842
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index ced75f3cb4dc..2d0442c44682 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -76,6 +76,7 @@
 #include <globalnames.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <comphelper/lok.hxx>
+#include <comphelper/flagguard.hxx>
 #include <config_fuzzers.h>
 #include <memory>
 
@@ -1442,10 +1443,10 @@ void ScDocument::Sort(
 {
     if (ScTable* pTable = FetchTable(nTab))
     {
-        bool bOldEnableIdle = IsIdleEnabled();
-        EnableIdle(false);
+        // Set idle enabled to "false" (if not already)
+        // out-of-scope will reset the value to the initial state
+        comphelper::FlagRestorationGuard aGuard(mbIdleEnabled, false);
         pTable->Sort(rSortParam, bKeepQuery, bUpdateRefs, pProgress, pUndo);
-        EnableIdle(bOldEnableIdle);
     }
 }
 

Reply via email to