mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
uidriver/glfw: Bug fix: Add more mutex locks for callbacks
Updates #1358
This commit is contained in:
parent
91b01ff83d
commit
3101ffd082
@ -276,10 +276,15 @@ func (i *Input) update(window *glfw.Window, context driver.UIContext) {
|
|||||||
if !unicode.IsPrint(char) {
|
if !unicode.IsPrint(char) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i.ui.m.Lock()
|
||||||
|
defer i.ui.m.Unlock()
|
||||||
i.runeBuffer = append(i.runeBuffer, char)
|
i.runeBuffer = append(i.runeBuffer, char)
|
||||||
})
|
})
|
||||||
window.SetScrollCallback(func(w *glfw.Window, xoff float64, yoff float64) {
|
window.SetScrollCallback(func(w *glfw.Window, xoff float64, yoff float64) {
|
||||||
// As this function is called from GLFW callbacks, the current thread is main.
|
// As this function is called from GLFW callbacks, the current thread is main.
|
||||||
|
i.ui.m.Lock()
|
||||||
|
defer i.ui.m.Unlock()
|
||||||
i.scrollX = xoff
|
i.scrollX = xoff
|
||||||
i.scrollY = yoff
|
i.scrollY = yoff
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user