graphics: Bug fix: Keep a restorable.Image before disposing

This commit is contained in:
Hajime Hoshi 2017-05-03 03:13:22 +09:00
parent e8e502cc26
commit f30b274c1f

View File

@ -58,12 +58,13 @@ func (i *images) add(img *restorable.Image) *Image {
}
func (i *images) remove(img *Image) {
r := img.restorable
if err := img.Dispose(); err != nil {
panic(err)
}
i.m.Lock()
defer i.m.Unlock()
delete(i.images, img.restorable)
delete(i.images, r)
runtime.SetFinalizer(img, nil)
}