Fix multiple close for channel (#1047)

This commit is contained in:
hiroebe 2020-01-08 12:50:57 +09:00 committed by Hajime Hoshi
parent 55bc2eaa22
commit 6ee587301c

View File

@ -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()
} }