From 44cfb92ceeb260477cb296b5f3ca4c21901d8c0c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 13 Jun 2022 12:28:17 +0900 Subject: [PATCH] internal/ui: bug fix: MaximizeWindow before Run caused an unexpected error on Windows Closes #2137 --- internal/ui/ui_glfw.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 72f6af9c6..0e2e8e563 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -678,10 +678,6 @@ func (u *userInterfaceImpl) createWindow(width, height int) error { u.window.SetTitle(u.title) // Icons are set after every frame. They don't have to be cared here. - u.registerWindowSetSizeCallback() - u.registerWindowCloseCallback() - u.registerWindowFramebufferSizeCallback() - u.updateWindowSizeLimits() return nil @@ -924,6 +920,12 @@ func (u *userInterfaceImpl) init() error { gamepad.SetNativeWindow(u.nativeWindow()) + // Register callbacks after the window initialization done. + // The callback might cause swapping frames, that assumes the window is already set (#2137). + u.registerWindowSetSizeCallback() + u.registerWindowCloseCallback() + u.registerWindowFramebufferSizeCallback() + return nil }