mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-09 22:46:55 +00:00
tpl: Fix deadlock in cached partials
Cached partials that contained cached partials would create a deadlock. Fixes #2935
This commit is contained in:
parent
dc61d3b6b3
commit
3ac1b9fe33
1 changed files with 3 additions and 0 deletions
|
@ -1541,7 +1541,10 @@ func (tf *templateFuncster) Get(key, name string, context interface{}) (p templa
|
||||||
|
|
||||||
tf.cachedPartials.Lock()
|
tf.cachedPartials.Lock()
|
||||||
if p, ok = tf.cachedPartials.p[key]; !ok {
|
if p, ok = tf.cachedPartials.p[key]; !ok {
|
||||||
|
tf.cachedPartials.Unlock()
|
||||||
p = tf.t.partial(name, context)
|
p = tf.t.partial(name, context)
|
||||||
|
|
||||||
|
tf.cachedPartials.Lock()
|
||||||
tf.cachedPartials.p[key] = p
|
tf.cachedPartials.p[key] = p
|
||||||
}
|
}
|
||||||
tf.cachedPartials.Unlock()
|
tf.cachedPartials.Unlock()
|
||||||
|
|
Loading…
Add table
Reference in a new issue