Skip to content

Commit

Permalink
Fix data race in test case
Browse files Browse the repository at this point in the history
  • Loading branch information
qlli committed Oct 9, 2024
1 parent 2b81afa commit 70ba13d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions sprite.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ const (
)

type Collider struct {
sprite *Sprite
others map[*Sprite]bool
sprite *Sprite
others map[*Sprite]bool
othersM sync.Mutex
}

func (c *Collider) SetTouching(other *Sprite, on bool) {
c.othersM.Lock()
defer c.othersM.Unlock()

if other == nil || c.sprite == nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion tutorial/05-Animation/Bullet.spx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
onTouched => {
onTouchStart => {
destroy
}

Expand Down

0 comments on commit 70ba13d

Please sign in to comment.