mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/uidriver/glfw: Bug fix: SEGV at setWindowSize
u.window can be a different value before and after the function setWindowSize. Closes #1522
This commit is contained in:
parent
c8b98f13fb
commit
fda421c5fe
@ -949,7 +949,11 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
|||||||
// ForceUpdate is called from the callback.
|
// ForceUpdate is called from the callback.
|
||||||
// While setWindowSize can be called from Update, calling ForceUpdate inside Update is illegal (#1505).
|
// While setWindowSize can be called from Update, calling ForceUpdate inside Update is illegal (#1505).
|
||||||
f := u.window.SetSizeCallback(nil)
|
f := u.window.SetSizeCallback(nil)
|
||||||
defer u.window.SetSizeCallback(f)
|
defer func() {
|
||||||
|
// u.window can be changed before this deferred function is executed.
|
||||||
|
// Wrap this call by an anonymous function (#1522).
|
||||||
|
u.window.SetSizeCallback(f)
|
||||||
|
}()
|
||||||
|
|
||||||
var windowRecreated bool
|
var windowRecreated bool
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user