You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... then the game window will not exit properly when clicking on the window close ("x") button. Hitting the "stop" button in the editor still works.
The workaround is to declare the thread as a daemon thread:
thread(daemon =true){
// ...
}
... as this will not prevent the JVM from exiting.
I don't think that this needs to have super high priority, but if a library would spawn threads (e.g. an async HTTP client might do that) and doesn't permit control over the creation of the thread, then this can become an issue.
Maybe this can be handled on the C++ side? It works when stopping the game via the godot editor "stop" button after all.
The text was updated successfully, but these errors were encountered:
We added a new callback system in #661. You can now use a new GD.callWhenClosing() method to register a lambda that will be run when the JVM ends. That should be used to close any third party threads, or at least terminate the library using even if you don't have direct control over it. The JVM won't close anyway if a non daemon thread is still alive, if somehow it doesn't allow that, it's a more general Kotlin/Java issue not related to Godot.
If we create a regular thread in Kotlin which keeps running, like so:
... then the game window will not exit properly when clicking on the window close ("x") button. Hitting the "stop" button in the editor still works.
The workaround is to declare the thread as a
daemon
thread:... as this will not prevent the JVM from exiting.
I don't think that this needs to have super high priority, but if a library would spawn threads (e.g. an async HTTP client might do that) and doesn't permit control over the creation of the thread, then this can become an issue.
Maybe this can be handled on the C++ side? It works when stopping the game via the godot editor "stop" button after all.
The text was updated successfully, but these errors were encountered: