shithub: hugo

Download patch

ref: 3ac1b9fe33c42f53f90f6868d82450213cf844d7
parent: dc61d3b6b38874473a40f0ba600e04dd7db111a3
author: Cameron Moore <moorereason@gmail.com>
date: Tue Jan 17 07:51:24 EST 2017

tpl: Fix deadlock in cached partials

Cached partials that contained cached partials would create a deadlock.

Fixes #2935

--- a/tpl/template_funcs.go
+++ b/tpl/template_funcs.go
@@ -1541,7 +1541,10 @@
 
 	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()
--