ui: Bug fix: Freezing on calling SetVsyncEnabled

This commit is contained in:
Hajime Hoshi 2018-07-17 02:37:22 +09:00
parent 16c6ab4d07
commit eb68cdad6e

View File

@ -320,10 +320,13 @@ func IsRunnableInBackground() bool {
func SetVsyncEnabled(enabled bool) {
u := currentUI
if !u.isRunning() {
_ = u.runOnMainThread(func() error {
// In general, m is used for locking init* values.
// m is not used for updating vsync in setScreenSize so far, but
// it should be OK since any goroutines can't reach here when
// the game already starts and setScreenSize can be called.
u.m.Lock()
u.vsync = enabled
return nil
})
u.m.Unlock()
return
}
_ = u.runOnMainThread(func() error {