mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/glfwwin: bug fix: update _glfw.windows
This commit is contained in:
parent
c99b948df3
commit
aa4a2b64e0
@ -93,6 +93,7 @@ func inputMonitor(monitor *Monitor, action PeripheralEvent, placement int) error
|
||||
for i, m := range _glfw.monitors {
|
||||
if m == monitor {
|
||||
copy(_glfw.monitors[i:], _glfw.monitors[i+1:])
|
||||
_glfw.monitors[len(_glfw.monitors)-1] = nil
|
||||
_glfw.monitors = _glfw.monitors[:len(_glfw.monitors)-1]
|
||||
break
|
||||
}
|
||||
|
@ -139,6 +139,7 @@ func CreateWindow(width, height int, title string, monitor *Monitor, share *Wind
|
||||
window.Destroy()
|
||||
}
|
||||
}()
|
||||
_glfw.windows = append(_glfw.windows, window)
|
||||
|
||||
// Open the actual window and create its context
|
||||
if err := window.platformCreateWindow(&wndconfig, &ctxconfig, &fbconfig); err != nil {
|
||||
@ -312,7 +313,7 @@ func (w *Window) Destroy() error {
|
||||
}
|
||||
|
||||
// Clear all callbacks to avoid exposing a half torn-down w object
|
||||
//memset(&w.callbacks, 0, sizeof(w.callbacks))
|
||||
// TODO: Clear w.callbacks
|
||||
|
||||
// The w's context must not be current on another thread when the
|
||||
// w is destroyed
|
||||
@ -326,6 +327,15 @@ func (w *Window) Destroy() error {
|
||||
}
|
||||
}
|
||||
|
||||
for i, window := range _glfw.windows {
|
||||
if window == w {
|
||||
copy(_glfw.windows[i:], _glfw.windows[i+1:])
|
||||
_glfw.windows[len(_glfw.windows)-1] = nil
|
||||
_glfw.windows = _glfw.windows[:len(_glfw.windows)-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
w.platformDestroyWindow()
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user