mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 10:42:42 +01:00
shareable: Add checks at operations for disposed images
This commit is contained in:
parent
9df977dff8
commit
ea1444ea7e
@ -131,6 +131,12 @@ func (i *Image) DrawImage(img *Image, sx0, sy0, sx1, sy1 int, geom *affine.GeoM,
|
|||||||
backendsM.Lock()
|
backendsM.Lock()
|
||||||
defer backendsM.Unlock()
|
defer backendsM.Unlock()
|
||||||
|
|
||||||
|
if img.disposed {
|
||||||
|
panic("shareable: the drawing source image must not be disposed")
|
||||||
|
}
|
||||||
|
if i.disposed {
|
||||||
|
panic("shareable: the drawing target image must not be disposed")
|
||||||
|
}
|
||||||
if img.backend == nil {
|
if img.backend == nil {
|
||||||
img.allocate(true)
|
img.allocate(true)
|
||||||
}
|
}
|
||||||
@ -155,6 +161,9 @@ func (i *Image) ReplacePixels(p []byte) {
|
|||||||
backendsM.Lock()
|
backendsM.Lock()
|
||||||
defer backendsM.Unlock()
|
defer backendsM.Unlock()
|
||||||
|
|
||||||
|
if i.disposed {
|
||||||
|
panic("shareable: the image must not be disposed")
|
||||||
|
}
|
||||||
if i.backend == nil {
|
if i.backend == nil {
|
||||||
i.allocate(true)
|
i.allocate(true)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user