fix(desktop): terminate process on exit; quit on close when no tray#5858
Merged
Conversation
Closing the desktop app left the JVM running. main() passed exitProcessOnExit = false to application(), so exitApplication() (tray Quit / Super+Q) ended the composition but never called exitProcess(0). Compose Desktop relies on AWT, whose non-daemon shutdown thread keeps the JVM alive until exitProcess() runs, so the process never terminated. Restore the default (true). Also fall back to exitApplication() on window-close when no system tray is available (e.g. some Linux DEs), so minimize-to-tray can't strand a windowless, trayless process. Fixes #5857 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closing the Meshtastic Desktop app left the process running with no window and no reliable way to quit. This restores normal exit behavior and adds a safety net for desktop environments that have no system tray.
Fixes #5857
🐛 Bug Fixes
main()passedexitProcessOnExit = falsetoapplication(). Compose Desktop relies on AWT, whose shutdown thread is non-daemon, so the JVM only exits whenexitProcess(0)runs — whichapplication()skips when that flag isfalse. As a resultexitApplication()(tray Quit and Super/Cmd+Q) ended the composition but never killed the process. Removed the flag to restore the documented default (true). Per theapplication()KDoc,falseis only for running code after theapplication{}block, which this expression-bodymaindoes not.exitApplication()whenisTraySupportedisfalse.Resulting behavior:
Where a tray exists, window-close still minimizes to it (unchanged); the tray Quit item and Super/Cmd+Q now genuinely terminate the process.
Verification
./gradlew :desktopApp:compileKotlin :desktopApp:spotlessCheck :desktopApp:detekt— all pass. The change is isolated to the desktop host shell (desktopApp/src/main/kotlin/org/meshtastic/desktop/Main.kt); no tests reference it and no other module depends on it, so the module-scoped checks are the complete relevant gate.