mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +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) {
|
func SetVsyncEnabled(enabled bool) {
|
||||||
u := currentUI
|
u := currentUI
|
||||||
if !u.isRunning() {
|
if !u.isRunning() {
|
||||||
_ = u.runOnMainThread(func() error {
|
// In general, m is used for locking init* values.
|
||||||
u.vsync = enabled
|
// m is not used for updating vsync in setScreenSize so far, but
|
||||||
return nil
|
// 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
|
return
|
||||||
}
|
}
|
||||||
_ = u.runOnMainThread(func() error {
|
_ = u.runOnMainThread(func() error {
|
||||||
|
Loading…
Reference in New Issue
Block a user