mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: image's texture may be nil and this must be considered when disposing
This commit is contained in:
parent
5f8ef3cf52
commit
0429c9c3e6
12
image.go
12
image.go
@ -141,10 +141,14 @@ func (i *Image) Dispose() error {
|
||||
if i.isDisposed() {
|
||||
return errors.New("image is already disposed")
|
||||
}
|
||||
i.framebuffer.Dispose(glContext)
|
||||
i.framebuffer = nil
|
||||
i.texture.Dispose(glContext)
|
||||
i.texture = nil
|
||||
if i.framebuffer != nil {
|
||||
i.framebuffer.Dispose(glContext)
|
||||
i.framebuffer = nil
|
||||
}
|
||||
if i.texture != nil {
|
||||
i.texture.Dispose(glContext)
|
||||
i.texture = nil
|
||||
}
|
||||
i.pixels = nil
|
||||
runtime.SetFinalizer(i, nil)
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user