Bugfix: Why did "Quit Vitto" in the context menu not actually quit t...
Documentation for Sessions
🐛 Bugfix: Why did "Quit Vitto" in the context menu not actually quit t...
Date: 2026-03-31
Time: 18:44:59 UTC
Session: gspace1-291.4
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why did "Quit Vitto" in the context menu not actually quit the app?
Task: S291.3 Fix Quit Vitto functionality
🎯 Decision Made
Chosen:
Changed quit_app command from app.exit(0) to std::process::exit(0)
Options Considered:
- Use std::process::exit(0) to bypass ExitRequested handler
- Add AtomicBool flag checked in ExitRequested to conditionally allow exit
- Remove api.prevent_exit() entirely (breaks tray behavior)
💭 Reasoning
Root cause: The Tauri RunEvent::ExitRequested handler calls api.prevent_exit() to keep the app alive as a tray/background app when windows close. This is correct for window-close events, but app.exit(0) also triggers ExitRequested, which then prevents the exit — creating a deadlock where the app can never quit via the frontend. std::process::exit(0) bypasses the Tauri event loop entirely, ensuring immediate termination. This is safe for an explicit user-initiated quit action. Alternative considered: adding an AtomicBool flag checked in ExitRequested to conditionally allow exit — rejected as over-engineered for a simple quit command.
📁 Files Involved
apps/vitto-desktop/src-tauri/src/lib.rs
🔗 Related
- Decision ID:
dev_1774982699319_48znjn1 - Session: 291
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation