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
14e6e4c92b
commit
d463e91524
12
image.go
12
image.go
@ -151,10 +151,14 @@ func (i *Image) Dispose() error {
|
||||
return errors.New("image is already disposed")
|
||||
}
|
||||
useGLContext(func(c *opengl.Context) {
|
||||
i.framebuffer.Dispose(c)
|
||||
i.framebuffer = nil
|
||||
i.texture.Dispose(c)
|
||||
i.texture = nil
|
||||
if i.framebuffer != nil {
|
||||
i.framebuffer.Dispose(c)
|
||||
i.framebuffer = nil
|
||||
}
|
||||
if i.texture != nil {
|
||||
i.texture.Dispose(c)
|
||||
i.texture = nil
|
||||
}
|
||||
})
|
||||
i.pixels = nil
|
||||
runtime.SetFinalizer(i, nil)
|
||||
|
Loading…
Reference in New Issue
Block a user