mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Bug fix: Freezing on calling SetVsyncEnabled
This commit is contained in:
parent
16c6ab4d07
commit
eb68cdad6e
@ -320,10 +320,13 @@ func IsRunnableInBackground() bool {
|
||||
func SetVsyncEnabled(enabled bool) {
|
||||
u := currentUI
|
||||
if !u.isRunning() {
|
||||
_ = u.runOnMainThread(func() error {
|
||||
u.vsync = enabled
|
||||
return nil
|
||||
})
|
||||
// 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
|
||||
u.m.Unlock()
|
||||
return
|
||||
}
|
||||
_ = u.runOnMainThread(func() error {
|
||||
|
Loading…
Reference in New Issue
Block a user