diff options
author | Cameron Moore <moorereason@gmail.com> | 2017-01-17 12:51:24 -0600 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-01-18 10:30:22 +0100 |
commit | 3ac1b9fe33c42f53f90f6868d82450213cf844d7 (patch) | |
tree | 27f72ff72d785715b8b35fc47492596d900098ea /tpl | |
parent | dc61d3b6b38874473a40f0ba600e04dd7db111a3 (diff) |
tpl: Fix deadlock in cached partials
Cached partials that contained cached partials would create a deadlock.
Fixes #2935
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/template_funcs.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go index 6c8a9957e..8f653808b 100644 --- a/tpl/template_funcs.go +++ b/tpl/template_funcs.go @@ -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() |