mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
graphics: Bug fix: Add lock to newSharedImagePart
This commit is contained in:
parent
c5872c6640
commit
2903f32d9b
@ -17,6 +17,7 @@ package ebiten
|
|||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/bsp"
|
"github.com/hajimehoshi/ebiten/internal/bsp"
|
||||||
"github.com/hajimehoshi/ebiten/internal/restorable"
|
"github.com/hajimehoshi/ebiten/internal/restorable"
|
||||||
|
"github.com/hajimehoshi/ebiten/internal/sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sharedImage struct {
|
type sharedImage struct {
|
||||||
@ -60,8 +61,12 @@ func (s *sharedImagePart) Dispose() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sharedImageLock sync.Mutex
|
||||||
|
|
||||||
func newSharedImagePart(width, height int) *sharedImagePart {
|
func newSharedImagePart(width, height int) *sharedImagePart {
|
||||||
// TODO: Lock!
|
sharedImageLock.Lock()
|
||||||
|
sharedImageLock.Unlock()
|
||||||
|
|
||||||
if width > bsp.MaxSize || height > bsp.MaxSize {
|
if width > bsp.MaxSize || height > bsp.MaxSize {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user