From 9dd501720eb211bc29e67494a32befcc9e5d078e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 12 Aug 2019 23:00:37 +0900 Subject: [PATCH] restorable: Bug fix: Unlocking should happen after restoring --- internal/restorable/images.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/restorable/images.go b/internal/restorable/images.go index 2e2f1ba94..540ddc5f0 100644 --- a/internal/restorable/images.go +++ b/internal/restorable/images.go @@ -78,13 +78,15 @@ func RestoreIfNeeded() error { // // Between each frame, any image operations are not permitted, or stale images would remain when restoring // (#913). - firsttime := false - theImages.once.Do(func() { - firsttime = true - }) - if !firsttime { - theImages.m.Unlock() - } + defer func() { + firsttime := false + theImages.once.Do(func() { + firsttime = true + }) + if !firsttime { + theImages.m.Unlock() + } + }() if !needsRestoring() { return nil