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