fix(macos): prevent SIGILL crash on exit by replacing viewport close with clean process exit
### Summary When selecting "Quit LightCraft" from the native macOS menu bar, the application occasionally crashes with an `EXC_BAD_INSTRUCTION` (SIGILL) error report during shutdown. ### Root Cause 1. The native menu action triggered `ctx.send_viewport_cmd(egui::ViewportCommand::Close)`. 2. Forcing an explicit viewport close via the command queue while macOS and AppKit are initiating their own termination sequence creates a race condition with `winit`. 3. This conflict during native window, view, and observer teardown leads to an illegal instruction fault. ### Solution - Replaced the manual `ViewportCommand::Close` trigger on `QUIT` with a clean `std::process::exit(0)`. - This bypasses the problematic `winit`/AppKit teardown race condition on macOS, allowing the application to shut down instantly and cleanly without generating crash reports.
This commit is contained in:
parent
3e76713c1d
commit
5c1dcd4f97
|
|
@ -360,8 +360,7 @@ impl NativeMenu {
|
|||
lightcraft_ui_egui::i18n::set_language(app.ui.language);
|
||||
while let Ok(key) = self.rx.try_recv() {
|
||||
if key == QUIT {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
|
||||
continue;
|
||||
std::process::exit(0);
|
||||
}
|
||||
if key == "app.about" || key == SETTINGS {
|
||||
let _ = app.run(&key, serde_json::json!({}));
|
||||
|
|
|
|||
Loading…
Reference in New Issue