diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-05-29 12:58:22 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-05-29 14:01:07 +0200 |
commit | 32585696be70dba987dbad299b22a05f9a820a49 (patch) | |
tree | 202537f9e982084a2f22c8452c7fd39374f9c8a5 /resources | |
parent | d47225ce9ef1a1ae31d89e8aed07a6fcc9d524f2 (diff) | |
download | hugo-32585696be70dba987dbad299b22a05f9a820a49.tar.gz hugo-32585696be70dba987dbad299b22a05f9a820a49.zip |
Fix potential deadlock in ByParam
Fixes #11039
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/pages_sort.go | 8 | ||||
-rw-r--r-- | resources/page/taxonomy.go | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/resources/page/pages_sort.go b/resources/page/pages_sort.go index b9b905cc2..32b1b3895 100644 --- a/resources/page/pages_sort.go +++ b/resources/page/pages_sort.go @@ -161,7 +161,7 @@ var collatorStringSort = func(getString func(Page) string) func(p Pages) { // Pages may be a mix of multiple languages, so we need to use the language // for the currently rendered Site. currentSite := p[0].Site().Current() - coll := langs.GetCollator(currentSite.Language()) + coll := langs.GetCollator1(currentSite.Language()) coll.Lock() defer coll.Unlock() @@ -173,7 +173,7 @@ var collatorStringSort = func(getString func(Page) string) func(p Pages) { var collatorStringCompare = func(getString func(Page) string, p1, p2 Page) int { currentSite := p1.Site().Current() - coll := langs.GetCollator(currentSite.Language()) + coll := langs.GetCollator1(currentSite.Language()) coll.Lock() c := coll.CompareStrings(getString(p1), getString(p2)) coll.Unlock() @@ -182,7 +182,9 @@ var collatorStringCompare = func(getString func(Page) string, p1, p2 Page) int { var collatorStringLess = func(p Page) (less func(s1, s2 string) bool, close func()) { currentSite := p.Site().Current() - coll := langs.GetCollator(currentSite.Language()) + // Make sure to use the second collator to prevent deadlocks. + // See issue 11039. + coll := langs.GetCollator2(currentSite.Language()) coll.Lock() return func(s1, s2 string) bool { return coll.CompareStrings(s1, s2) < 1 diff --git a/resources/page/taxonomy.go b/resources/page/taxonomy.go index f50152f90..3aa0c7a7b 100644 --- a/resources/page/taxonomy.go +++ b/resources/page/taxonomy.go @@ -83,7 +83,7 @@ func (i Taxonomy) Alphabetical() OrderedTaxonomy { return ia } currentSite := p.Site().Current() - coll := langs.GetCollator(currentSite.Language()) + coll := langs.GetCollator1(currentSite.Language()) coll.Lock() defer coll.Unlock() name := func(i1, i2 *OrderedTaxonomyEntry) bool { |