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 authored and Bjørn Erik Pedersen committed 2017-01-18 10:30:22 +01:00
1 parent dc61d3b6b3
commit 3ac1b9fe33
1 file changed
+3
+3
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()