uidriver/glfw: Fix thread issues at reqWidth/reqHeight

This commit is contained in:
Hajime Hoshi 2019-12-08 02:44:14 +09:00
parent 22e3db6814
commit 63fbffa9f6

View File

@ -871,13 +871,19 @@ func (u *UserInterface) update(context driver.UIContext) error {
} }
// Update the screen size when the window is resizable. // Update the screen size when the window is resizable.
// TODO: Need locks. var w, h int
w, h := u.reqWidth, u.reqHeight _ = u.t.Call(func() error {
w, h = u.reqWidth, u.reqHeight
return nil
})
if w != 0 || h != 0 { if w != 0 || h != 0 {
u.setScreenSize(w, h, u.scale, u.isFullscreen(), u.vsync) u.setScreenSize(w, h, u.scale, u.isFullscreen(), u.vsync)
} }
u.reqWidth = 0 _ = u.t.Call(func() error {
u.reqHeight = 0 u.reqWidth = 0
u.reqHeight = 0
return nil
})
return nil return nil
} }