rendering: don't pause on quit

This fixes a jvm crash when a rendering error occurs
This commit is contained in:
Bixilon 2022-11-14 11:07:52 +01:00
parent 89435bed4b
commit 08c26e8c3d
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 11 additions and 7 deletions

View File

@ -206,7 +206,7 @@ class RenderWindow(
inputHandler.init()
DefaultKeyCombinations.registerAll(this)
this::state.observe(this) {
if (it != RenderingStates.RUNNING) {
if (it == RenderingStates.PAUSED || it == RenderingStates.SLOW || it == RenderingStates.STOPPED) {
pause(true)
}
}

View File

@ -19,6 +19,7 @@ import de.bixilon.minosoft.assets.AssetsManager
import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateWatcher.Companion.profileWatchRendering
import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfile
import de.bixilon.minosoft.gui.rendering.RenderWindow
import de.bixilon.minosoft.gui.rendering.events.WindowCloseEvent
import de.bixilon.minosoft.terminal.RunConfiguration
import de.bixilon.minosoft.util.KUtil.toResourceLocation
import de.matthiasmann.twl.utils.PNGDecoder
@ -65,7 +66,14 @@ interface BaseWindow {
fun destroy()
fun close()
fun close() {
if (fireGLFWEvent(WindowCloseEvent(renderWindow, window = this))) {
return
}
forceClose()
}
fun forceClose()
fun swapBuffers()

View File

@ -247,11 +247,7 @@ class GLFWWindow(
glfwSetErrorCallback(null)?.free()
}
override fun close() {
if (fireGLFWEvent(WindowCloseEvent(renderWindow, window = this))) {
return
}
override fun forceClose() {
glfwSetWindowShouldClose(window, true)
}