shareable: Bug fix: Call SetFinalizer whenever a new image is created

Fixes #637
This commit is contained in:
Hajime Hoshi 2018-06-28 22:23:01 +09:00
parent 934251ab83
commit 91dbb73799

View File

@ -273,6 +273,7 @@ func (i *Image) allocate(shareable bool) {
i.backend = &backend{
restorable: restorable.NewImage(i.width, i.height, false),
}
runtime.SetFinalizer(i, (*Image).Dispose)
return
}
@ -280,6 +281,7 @@ func (i *Image) allocate(shareable bool) {
if n, ok := b.TryAlloc(i.width, i.height); ok {
i.backend = b
i.node = n
runtime.SetFinalizer(i, (*Image).Dispose)
return
}
}