mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
internal/atlas: close channels on the sender side just in case
This commit is contained in:
parent
ad51e22252
commit
913824beba
@ -547,7 +547,10 @@ func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte
|
|||||||
ch := make(chan error)
|
ch := make(chan error)
|
||||||
deferredM.Lock()
|
deferredM.Lock()
|
||||||
deferred = append(deferred, func() {
|
deferred = append(deferred, func() {
|
||||||
ch <- i.readPixels(graphicsDriver, pixels, region)
|
if err := i.readPixels(graphicsDriver, pixels, region); err != nil {
|
||||||
|
ch <- err
|
||||||
|
}
|
||||||
|
close(ch)
|
||||||
})
|
})
|
||||||
deferredM.Unlock()
|
deferredM.Unlock()
|
||||||
return ch
|
return ch
|
||||||
@ -558,7 +561,10 @@ func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte
|
|||||||
flushDeferred()
|
flushDeferred()
|
||||||
|
|
||||||
ch := make(chan error, 1)
|
ch := make(chan error, 1)
|
||||||
ch <- i.readPixels(graphicsDriver, pixels, region)
|
if err := i.readPixels(graphicsDriver, pixels, region); err != nil {
|
||||||
|
ch <- err
|
||||||
|
}
|
||||||
|
close(ch)
|
||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user