{"record":{"id":"f029b01d877b667d","repo":"slint-ui/slint","slug":"the-window-shouldn-t-be-initialized-before-this-ca","errorCode":null,"errorMessage":"The window shouldn't be initialized before this call","messagePattern":"The window shouldn't be initialized before this call","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/compiler/generator/rust.rs","lineNumber":646,"sourceCode":"    // `create_window_from_context` is only invoked from a Window-rooted\n    // public component's `new_with_context`, and `maybe_window_adapter_impl`\n    // is only invoked from per-tree `register_item_tree` / PinnedDrop hooks\n    // — both gated out for tray-only units. Emit them only when something\n    // actually calls them; otherwise `#![deny(warnings)]` builds (e.g.\n    // test-driver-rust with `--features build-time`) trip on dead_code.\n    // `window_adapter_impl` / `window_adapter_ref` are kept unconditionally\n    // because expression codegen (layout-info, font metrics) still\n    // references them on every tree.\n    let optional_window_adapter_helpers = needs_window_adapter.then(|| {\n        quote!(\n            #[cfg(#experimental)]\n            fn create_window_from_context(&self, ctx: sp::SlintContext) -> sp::Result<(), slint::PlatformError> {\n                let adapter = ctx.platform().create_window_adapter()?;\n                sp::WindowInner::from_pub(adapter.window()).set_context(ctx);\n                let root_rc = self.root_item_tree_weak.upgrade().unwrap();\n                sp::WindowInner::from_pub(adapter.window()).set_component(&root_rc);\n                #apply_constant_scale_factor\n                self.window_adapter.set(adapter).map_err(|_|()).expect(\"The window shouldn't be initialized before this call\");\n                sp::Ok(())\n            }\n\n            #[cfg(#experimental)]\n            fn create_window_from_existing(&self, window: &slint::Window) -> sp::Result<(), slint::PlatformError> {\n                let adapter = sp::WindowInner::from_pub(window).window_adapter();\n                let root_rc = self.root_item_tree_weak.upgrade().unwrap();\n                sp::WindowInner::from_pub(adapter.window()).set_component(&root_rc);\n                #apply_constant_scale_factor\n                self.window_adapter.set(adapter).map_err(|_|()).expect(\"The window shouldn't be initialized before this call\");\n                sp::Ok(())\n            }\n\n            fn maybe_window_adapter_impl(&self) -> sp::Option<sp::Rc<dyn sp::WindowAdapter>> {\n                self.window_adapter.get().cloned()\n            }\n        )\n    });","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/internal/compiler/generator/rust.rs#L628-L664","documentation":"Error \"The window shouldn't be initialized before this call\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at internal/compiler/generator/rust.rs:646 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Internal compiler error: report the .slint code triggering this assertion.","Regenerate the Rust code from a clean build."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}