graphics: Bug fix: Add lock to newSharedImagePart

This commit is contained in:
Hajime Hoshi 2018-03-03 20:50:26 +09:00
parent c5872c6640
commit 2903f32d9b

View File

@ -17,6 +17,7 @@ package ebiten
import (
"github.com/hajimehoshi/ebiten/internal/bsp"
"github.com/hajimehoshi/ebiten/internal/restorable"
"github.com/hajimehoshi/ebiten/internal/sync"
)
type sharedImage struct {
@ -60,8 +61,12 @@ func (s *sharedImagePart) Dispose() {
}
}
var sharedImageLock sync.Mutex
func newSharedImagePart(width, height int) *sharedImagePart {
// TODO: Lock!
sharedImageLock.Lock()
sharedImageLock.Unlock()
if width > bsp.MaxSize || height > bsp.MaxSize {
return nil
}