mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
Fix multiple close for channel (#1047)
This commit is contained in:
parent
55bc2eaa22
commit
6ee587301c
@ -104,6 +104,7 @@ type UserInterface struct {
|
|||||||
gbuildWidthPx int
|
gbuildWidthPx int
|
||||||
gbuildHeightPx int
|
gbuildHeightPx int
|
||||||
setGBuildSizeCh chan struct{}
|
setGBuildSizeCh chan struct{}
|
||||||
|
once sync.Once
|
||||||
|
|
||||||
context driver.UIContext
|
context driver.UIContext
|
||||||
|
|
||||||
@ -336,7 +337,9 @@ func (u *UserInterface) setGBuildSize(widthPx, heightPx int) {
|
|||||||
u.gbuildWidthPx = widthPx
|
u.gbuildWidthPx = widthPx
|
||||||
u.gbuildHeightPx = heightPx
|
u.gbuildHeightPx = heightPx
|
||||||
u.sizeChanged = true
|
u.sizeChanged = true
|
||||||
close(u.setGBuildSizeCh)
|
u.once.Do(func() {
|
||||||
|
close(u.setGBuildSizeCh)
|
||||||
|
})
|
||||||
u.m.Unlock()
|
u.m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user