{"record":{"id":"64c20f9cb5528785","repo":"slint-ui/slint","slug":"c-nativewindowhandle-created-with-null-hwnd","errorCode":null,"errorMessage":"C++: NativeWindowHandle created with null hwnd","messagePattern":"C\\+\\+: NativeWindowHandle created with null hwnd","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/cpp/platform.rs","lineNumber":794,"sourceCode":"\n    struct CppRawHandle(Arc<RawHandlePair>);\n\n    impl From<(RawWindowHandle, RawDisplayHandle)> for CppRawHandle {\n        fn from(pair: (RawWindowHandle, RawDisplayHandle)) -> Self {\n            Self(Arc::new(RawHandlePair(pair)))\n        }\n    }\n\n    type CppRawHandleOpaque = *const c_void;\n\n    #[unsafe(no_mangle)]\n    pub unsafe extern \"C\" fn slint_new_raw_window_handle_win32(\n        hwnd: *mut c_void,\n        _hinstance: *mut c_void,\n    ) -> CppRawHandleOpaque {\n        let handle = CppRawHandle::from((\n            RawWindowHandle::Win32(raw_window_handle::Win32WindowHandle::new(\n                (hwnd as isize).try_into().expect(\"C++: NativeWindowHandle created with null hwnd\"),\n            )),\n            RawDisplayHandle::Windows(raw_window_handle::WindowsDisplayHandle::new()),\n        ));\n        Box::into_raw(Box::new(handle)) as CppRawHandleOpaque\n    }\n\n    #[unsafe(no_mangle)]\n    pub unsafe extern \"C\" fn slint_new_raw_window_handle_x11_xcb(\n        window: u32,\n        visual_id: u32,\n        connection: *mut c_void,\n        screen: core::ffi::c_int,\n    ) -> CppRawHandleOpaque {\n        use raw_window_handle::{XcbDisplayHandle, XcbWindowHandle};\n        let handle = CppRawHandle::from((\n            RawWindowHandle::Xcb({\n                let mut hnd = XcbWindowHandle::new(\n                    window","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/api/cpp/platform.rs#L776-L812","documentation":"Error \"C++: NativeWindowHandle created with null hwnd\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at api/cpp/platform.rs:794 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not create a NativeWindowHandle with a null HWND on Windows.","Obtain a valid window handle before calling."],"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"}