svl/source/items/itemset.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 8af6da9309ccf12af085ac66f22e9249b9621823
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Feb 16 10:39:33 2026 +0200
Commit:     Aron Budea <[email protected]>
CommitDate: Mon Feb 16 21:14:41 2026 +0100

    tdf#170827 FILEOPEN XLSX File hangs Calc when opened
    
    regression from
      commit b1df5786458223f21f0eaa9627c0f4c6fa5f1747
      Author: Noel Grandin <[email protected]>
      Date:   Sun Dec 21 19:55:04 2025 +0200
      tdf#166684 use hashing in CellAttributeHelper::registerAndCheck
    
    Change-Id: Ibe17b14fd93da584aff551e774150d42294055c6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199451
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    (cherry picked from commit 7d519f0706356c2b442143fe8f70f38f7e776b05)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199473
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Aron Budea <[email protected]>

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 122e22c2ab78..27ccaf7ca63b 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1291,6 +1291,12 @@ bool SfxItemSet::Equals(const SfxItemSet &rCmp, bool 
bComparePool) const
 
 size_t SfxItemSet::GetHashCode() const
 {
+    // We are calculating a hash in an odd way here. This is not ideal, because
+    // it does not produce as good a result as using o3tl::hash_combine.
+    // However, m_aPoolItemMap is an __unordered__ map, and so using 
o3tl::hash_combine
+    // will not necessarily produce the same hash for two otherwise identical 
SfxItemSet.
+    // Using addition is invariant with respect to ordering, so we sacrifice 
some hashing
+    // quality in favour of correctness.
     size_t seed = 0;
 
     for (PoolItemMap::const_iterator it(m_aPoolItemMap.begin()); it != 
m_aPoolItemMap.end(); it++)
@@ -1298,10 +1304,10 @@ size_t SfxItemSet::GetHashCode() const
         const sal_uInt16 nWhich = it->first;
         const SfxPoolItem *pItem = it->second;
 
-        o3tl::hash_combine(seed, nWhich);
+        seed += nWhich;
         if (!IsInvalidItem(pItem) && !IsDisabledItem(pItem)
             && pItem && pItem->supportsHashCode())
-            o3tl::hash_combine(seed, pItem->hashCode());
+            seed += pItem->hashCode();
     }
 
     return seed;

Reply via email to