mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
graphics: Bug fix: Keep a restorable.Image before disposing
This commit is contained in:
parent
e8e502cc26
commit
f30b274c1f
3
image.go
3
image.go
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user