From: Bjørn Erik Pedersen Date: Sat, 21 Nov 2015 19:03:18 +0000 (+0100) Subject: Fix recently introduced new data race in the shortcode handling X-Git-Tag: v0.15~26 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=58c446f56282cb8c24f5dce0ef03e5e7bebe00ef;p=brevno-suite%2Fhugo Fix recently introduced new data race in the shortcode handling Fixes #1599 --- diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index e65a8598..c49418b8 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -343,9 +343,14 @@ Loop: if tmpl == nil { return sc, fmt.Errorf("Unable to locate template for shortcode '%s' in page %s", sc.name, p.BaseFileName()) } + + // TODO(bep) Refactor/rename this lock strategy + isInnerShortcodeCache.Lock() if tmpl.Tree == nil { + isInnerShortcodeCache.Unlock() return sc, fmt.Errorf("Template for shortcode '%s' failed to compile for page '%s'", sc.name, p.BaseFileName()) } + isInnerShortcodeCache.Unlock() isInner = isInnerShortcode(tmpl) case tScParam: