rendering: properly close window

This still makes the window freeze on wayland, not sure if I should blame the glfw update to kde.
This commit is contained in:
Moritz Zwerger 2024-10-29 23:33:04 +01:00
parent 8cfa0eb0f1
commit de1d3541a6
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -59,7 +59,7 @@ class RenderLoop(
context.window.pollEvents() context.window.pollEvents()
} }
if (context.session.established || !context.state.active) { if (context.state == RenderingStates.QUITTING || context.session.established || !context.state.active) {
break break
} }
@ -102,10 +102,6 @@ class RenderLoop(
// handle opengl context tasks, but limit it per frame // handle opengl context tasks, but limit it per frame
context.queue.workTimeLimited(RenderConstants.MAXIMUM_QUEUE_TIME_PER_FRAME) context.queue.workTimeLimited(RenderConstants.MAXIMUM_QUEUE_TIME_PER_FRAME)
if (context.state == RenderingStates.STOPPED) {
context.window.close()
break
}
if (context.state == RenderingStates.SLOW && slowRendering) { if (context.state == RenderingStates.SLOW && slowRendering) {
Thread.sleep(100L) Thread.sleep(100L)
} }
@ -122,6 +118,7 @@ class RenderLoop(
Log.log(LogMessageType.RENDERING) { "Destroying render window..." } Log.log(LogMessageType.RENDERING) { "Destroying render window..." }
context.state = RenderingStates.STOPPED context.state = RenderingStates.STOPPED
context.window.forceClose()
context.system.destroy() context.system.destroy()
context.window.destroy() context.window.destroy()
Log.log(LogMessageType.RENDERING) { "Render window destroyed!" } Log.log(LogMessageType.RENDERING) { "Render window destroyed!" }