mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +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) {
|
func (i *images) remove(img *Image) {
|
||||||
|
r := img.restorable
|
||||||
if err := img.Dispose(); err != nil {
|
if err := img.Dispose(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
i.m.Lock()
|
i.m.Lock()
|
||||||
defer i.m.Unlock()
|
defer i.m.Unlock()
|
||||||
delete(i.images, img.restorable)
|
delete(i.images, r)
|
||||||
runtime.SetFinalizer(img, nil)
|
runtime.SetFinalizer(img, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user