{"record":{"id":"7e579bd3707ad6e9","repo":"iced-rs/iced","slug":"send-control-action","errorCode":null,"errorMessage":"Send control action","messagePattern":"Send control action","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"winit/src/lib.rs","lineNumber":1001,"sourceCode":"                                    for (_id, window) in window_manager.iter_mut() {\n                                        window.raw.request_redraw();\n                                    }\n                                }\n                            },\n                        }\n                    }\n                    event::Event::WindowEvent {\n                        event: window_event,\n                        window_id,\n                    } => {\n                        if !is_daemon\n                            && matches!(window_event, winit::event::WindowEvent::Destroyed)\n                            && !is_window_opening\n                            && window_manager.is_empty()\n                        {\n                            control_sender\n                                .start_send(Control::Exit)\n                                .expect(\"Send control action\");\n\n                            continue;\n                        }\n\n                        let Some((id, window)) = window_manager.get_mut_alias(window_id) else {\n                            continue;\n                        };\n\n                        match window_event {\n                            winit::event::WindowEvent::Resized(_)\n                            | winit::event::WindowEvent::Occluded(false) => {\n                                window.raw.request_redraw();\n                            }\n                            winit::event::WindowEvent::ThemeChanged(theme) => {\n                                let mode = conversion::theme_mode(theme);\n\n                                if mode != system_theme {\n                                    system_theme = mode;","sourceCodeStart":983,"sourceCodeEnd":1019,"githubUrl":"https://github.com/iced-rs/iced/blob/d146509d893945de5c304cfaf4301335eee278bd/winit/src/lib.rs#L983-L1019","documentation":"Panic from `control_sender.start_send(Control::Exit).expect(\"Send control action\")` when the last window is destroyed. Fails only if the control channel receiver was dropped — i.e. the runtime's control loop already ended — an internal invariant violation of the control-flow channel.","triggerScenarios":"The last winit window reports Destroyed while the control_sender's receiver no longer exists (control loop exited early, e.g. after a Crash or during shutdown race with is_window_opening).","commonSituations":"Closing the final window during application teardown; crash handling that terminated the control consumer; nested/multiple runtimes sharing channels.","solutions":["Update iced/winit to latest","Ensure you run a single application instance and don't drop the runtime while windows are open","Fork fix: replace expect with `let _ = control_sender.start_send(Control::Exit);`"],"exampleFix":"// before\ncontrol_sender.start_send(Control::Exit).expect(\"Send control action\");\n// after\nlet _ = control_sender.start_send(Control::Exit);","handlingStrategy":"fallback","validationCode":"// check window_manager.is_empty() only in the normal loop; avoid dropping the runtime while windows are open","typeGuard":null,"tryCatchPattern":"// fork fix: replace expect with `let _ = control_sender.start_send(Control::Exit);`","preventionTips":["Run a single application instance; don't drop the runtime while windows exist","Handle Crash/Exit paths so the control loop always outlives the last window close","Update iced/winit"],"tags":["panic","channel","window-close","shutdown"],"backgroundTag":"broken-pipe","analyzedSha":"d146509d893945de5c304cfaf4301335eee278bd","analyzedAt":"2026-09-11T16:54:14.229Z","contentChangedAt":"2026-09-11T16:54:14.229Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}