tpl: Fix deadlock in cached partials

Cached partials that contained cached partials would create a deadlock.

Fixes #2935
This commit is contained in:
Cameron Moore 2017-01-17 12:51:24 -06:00 committed by Bjørn Erik Pedersen
parent dc61d3b6b3
commit 3ac1b9fe33

View file

@ -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()