sc/source/ui/cctrl/checklistmenu.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 7a2a12062183a1facdfa1dcb1624c537081afac1
Author:     Sahil Gautam <[email protected]>
AuthorDate: Thu Dec 4 13:50:20 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Dec 12 12:32:51 2025 +0100

    Related tdf#167395: Break out of the loop after the entry has been found
    
    autofilter represents multiple instances of an entry as a single entry
    in the filter popup for obvious reasons, so we need not loop over all
    the entries to find other instances of the current entry.
    
    Change-Id: I72b2c7bd141615ac0c50927dfa7784f9b569e9ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195060
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 3f4c2bd3e3e712316e0d46b4f803b3bdc4f6ee5c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195455
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index cd66538719b1..9009af0a4fe4 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -864,14 +864,29 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, LockCheckedHdl, 
weld::Toggleable&, void)
         if (mpChecks->get_toggle(rEntry) == TRISTATE_TRUE)
         {
             for (auto& aMember : maMembers)
+            {
                 if (aMember.maName == mpChecks->get_text(rEntry))
+                {
                     aMember.mbMarked = true;
+                    /*
+                     * if there are multiple entries with the same
+                     * name in the range, they all show up as a single
+                     * entry in the autofilter, so we can break
+                     */
+                    break;
+                }
+            }
         }
         else
         {
             for (auto& aMember : maMembers)
+            {
                 if (aMember.maName == mpChecks->get_text(rEntry))
+                {
                     aMember.mbCheck = false;
+                    break;
+                }
+            }
         }
 
         return false;

Reply via email to