mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +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")
|
return errors.New("image is already disposed")
|
||||||
}
|
}
|
||||||
useGLContext(func(c *opengl.Context) {
|
useGLContext(func(c *opengl.Context) {
|
||||||
i.framebuffer.Dispose(c)
|
if i.framebuffer != nil {
|
||||||
i.framebuffer = nil
|
i.framebuffer.Dispose(c)
|
||||||
i.texture.Dispose(c)
|
i.framebuffer = nil
|
||||||
i.texture = nil
|
}
|
||||||
|
if i.texture != nil {
|
||||||
|
i.texture.Dispose(c)
|
||||||
|
i.texture = nil
|
||||||
|
}
|
||||||
})
|
})
|
||||||
i.pixels = nil
|
i.pixels = nil
|
||||||
runtime.SetFinalizer(i, nil)
|
runtime.SetFinalizer(i, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user