From dff492955d95c808eb353d0a60b926f96acc7c9c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 26 Apr 2018 01:51:57 +0900 Subject: [PATCH] shareable: Reset finalizer in any cases --- internal/shareable/shareable.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/shareable/shareable.go b/internal/shareable/shareable.go index 2392600be..670c3308e 100644 --- a/internal/shareable/shareable.go +++ b/internal/shareable/shareable.go @@ -171,16 +171,16 @@ func (i *Image) Dispose() { } func (i *Image) dispose() { - if i.isDisposed() { - return - } - defer func() { i.backend = nil i.node = nil runtime.SetFinalizer(i, nil) }() + if i.isDisposed() { + return + } + if i.node == nil { i.backend.restorable.Dispose() return