{"record":{"id":"8f388252bc71a05d","repo":"slint-ui/slint","slug":"unable-to-quit-event-loop-multiple-times","errorCode":null,"errorMessage":"Unable to quit event loop multiple times","messagePattern":"Unable to quit event loop multiple times","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backends/linuxkms/calloop_backend/input.rs","lineNumber":358,"sourceCode":"                    );\n\n                    let control = xkb_key_state\n                        .mod_name_is_active(xkb::MOD_NAME_CTRL, xkb::STATE_MODS_EFFECTIVE);\n                    let alt = xkb_key_state\n                        .mod_name_is_active(xkb::MOD_NAME_ALT, xkb::STATE_MODS_EFFECTIVE);\n\n                    if state == KeyState::Pressed {\n                        //eprintln!(\n                        //\"key {} state {:#?} sym {:x} control {control} alt {alt}\",\n                        //key_code, state, sym\n                        //);\n\n                        if (sym == xkb::Keysym::Delete || sym == xkb::Keysym::BackSpace)\n                            && alt\n                            && control\n                        {\n                            i_slint_core::api::quit_event_loop()\n                                .expect(\"Unable to quit event loop multiple times\");\n                        } else if (xkb::Keysym::XF86_Switch_VT_1..=xkb::Keysym::XF86_Switch_VT_12)\n                            .contains(&sym)\n                        {\n                            // let target_vt = (sym - xkb::KEY_XF86Switch_VT_1 + 1) as i32;\n                            // TODO: eprintln!(\"switch vt {target_vt}\");\n                        }\n                    }\n\n                    if let Some(text) = map_key_sym(sym) {\n                        let event = match state {\n                            KeyState::Pressed => WindowEvent::KeyPressed { text },\n                            KeyState::Released => WindowEvent::KeyReleased { text },\n                        };\n                        window.dispatch_event_with_result(event).map_err(Self::Error::other)?;\n                    }\n                }\n                _ => {}\n            }","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/backends/linuxkms/calloop_backend/input.rs#L340-L376","documentation":"When the user presses Ctrl+Alt+Delete or Ctrl+Alt+Backspace on the linuxkms backend, `quit_event_loop()` is called and its Result is unwrapped with `expect(\"Unable to quit event loop multiple times\")`. `quit_event_loop` returns an error if the event loop is not running or has already been asked to quit, so a repeated keypress (or a quit during loop teardown) panics inside the event-processing callback.","triggerScenarios":"Pressing Ctrl+Alt+Del or Ctrl+Alt+Backspace twice (or after the event loop already received a quit request / while the loop is being torn down) in an application using the linuxkms calloop backend.","commonSituations":"Full-screen kiosk/embedded apps where a frustrated user mashes the quit hotkey; quit triggered programmatically right before the hotkey press; event loop already exiting due to window close or error.","solutions":["Ignore the Result instead of expecting: replace `.expect(...)` with `let _ = i_slint_core::api::quit_event_loop();` — quitting twice is benign.","Check the returned error and log it rather than panicking in the input callback.","Guard application-side: once quit is requested, stop processing further quit hotkey presses (track a quit_requested flag)."],"exampleFix":"// before\ni_slint_core::api::quit_event_loop()\n    .expect(\"Unable to quit event loop multiple times\");\n\n// after\nlet _ = i_slint_core::api::quit_event_loop();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// treat double-quit as benign in the hotkey handler\nif let Err(e) = i_slint_core::api::quit_event_loop() {\n    eprintln!(\"quit_event_loop: {e}\"); // already quitting or not running\n}","preventionTips":["Never .expect() on quit_event_loop in input handlers; the event loop may already be quitting","Track a quit_requested flag to skip duplicate quit hotkey handling","Test hotkey mash scenarios in kiosk/embedded deployments"],"tags":["linuxkms","event-loop","keyboard","panic"],"backgroundTag":"invalid-state-transition","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}