Skip to content

Commit

Permalink
tpl: Fix deadlock in cached partials
Browse files Browse the repository at this point in the history
Cached partials that contained cached partials would create a deadlock.

Fixes #2935
  • Loading branch information
moorereason authored and bep committed Jan 18, 2017
1 parent dc61d3b commit 3ac1b9f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tpl/template_funcs.go
Expand Up @@ -1541,7 +1541,10 @@ func (tf *templateFuncster) Get(key, name string, context interface{}) (p templa

tf.cachedPartials.Lock()
if p, ok = tf.cachedPartials.p[key]; !ok {
tf.cachedPartials.Unlock()
p = tf.t.partial(name, context)

tf.cachedPartials.Lock()
tf.cachedPartials.p[key] = p
}
tf.cachedPartials.Unlock()
Expand Down

0 comments on commit 3ac1b9f

Please sign in to comment.