mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 08:58:02 -04:00
glfw: fix crash when window size is <= 0
Windows sets the window size to (0,0) when minimizing the window. That leads to eventual division by zero errors and opengl does not want to attach a framebuffer with that size, resulting in it being incomplete. After maximizing again, it tries to unload that framebuffer, but it was never loaded. Minosoft crashes with an invalid framebuffer state: deleted
This commit is contained in:
parent
e2f30887ff
commit
a63b020e53
@ -351,8 +351,10 @@ class GLFWWindow(
|
||||
if (window != this.window) {
|
||||
return
|
||||
}
|
||||
val previousSize = Vec2i(_size)
|
||||
val nextSize = unscalePosition(Vec2i(width, height))
|
||||
if (nextSize.x <= 0 || nextSize.y <= 0) return // windows returns size (0,0) if minimized
|
||||
val previousSize = Vec2i(_size)
|
||||
if (previousSize == nextSize) return
|
||||
_size = nextSize
|
||||
fireGLFWEvent(ResizeWindowEvent(context, previousSize = previousSize, size = _size))
|
||||
this.skipNextMouseEvent = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user