{"record":{"id":"596b389dc3092534","repo":"iced-rs/iced","slug":"non-zero-height","errorCode":null,"errorMessage":"Non-zero height","messagePattern":"Non-zero height","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tiny_skia/src/window/compositor.rs","lineNumber":83,"sourceCode":"            window,\n            clip_mask: tiny_skia::Mask::new(1, 1).expect(\"Create clip mask\"),\n            frames: VecDeque::new(),\n            max_age: 0,\n        };\n\n        if width > 0 && height > 0 {\n            self.configure_surface(&mut surface, width, height);\n        }\n\n        surface\n    }\n\n    fn configure_surface(&mut self, surface: &mut Self::Surface, width: u32, height: u32) {\n        surface\n            .window\n            .resize(\n                NonZeroU32::new(width).expect(\"Non-zero width\"),\n                NonZeroU32::new(height).expect(\"Non-zero height\"),\n            )\n            .expect(\"Resize surface\");\n\n        surface.clip_mask = tiny_skia::Mask::new(width, height).expect(\"Create clip mask\");\n        surface.frames.clear();\n    }\n\n    fn information(&self) -> Information {\n        Information {\n            adapter: String::from(\"CPU\"),\n            backend: String::from(\"tiny-skia\"),\n        }\n    }\n\n    fn present(\n        &mut self,\n        renderer: &mut Self::Renderer,\n        surface: &mut Self::Surface,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/iced-rs/iced/blob/3de451447bd28217bb535632867550908e29d5d0/tiny_skia/src/window/compositor.rs#L65-L101","documentation":"The height half of configure_surface's NonZeroU32 conversion: NonZeroU32::new(height).expect(\"Non-zero height\") panics when height == 0. create_surface guards both dimensions (compositor.rs:71) and iced_winit filters zero physical sizes before configuring (winit/src/lib.rs:759-761), so the panic requires calling the Compositor trait's configure_surface directly with a zero height, e.g. from a custom windowing loop.","triggerScenarios":"A custom runtime calling configure_surface(&mut surface, width, 0) for a minimized or not-yet-sized window; forwarding winit Resized events with unfiltered inner_size() values; driving the compositor in tests with dummy 0-height viewports.","commonSituations":"Minimized windows on Windows/Linux reporting 0 height; custom embedded runtimes that skip iced_winit's guards; race conditions between window creation and the first size event.","solutions":["Filter zero-height resize events before calling configure_surface","Clamp height to 1 when a valid surface must exist even for hidden windows","Reuse the stock iced_winit runtime, which already skips configuration on 0x0"],"exampleFix":"// before\ncompositor.configure_surface(&mut surface, size.width, size.height);\n\n// after\nif size.width > 0 && size.height > 0 {\n    compositor.configure_surface(&mut surface, size.width, size.height);\n}","handlingStrategy":"validation","validationCode":"// Before configuring a surface in a custom runtime:\nfn is_configurable(size: (u32, u32)) -> bool {\n    size.0 > 0 && size.1 > 0\n}\n\nif is_configurable((physical.width, physical.height)) {\n    compositor.configure_surface(&mut surface, physical.width, physical.height);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 0x0 resize events as 'window hidden', not as a size to apply","Clamp to 1x1 only when a valid backbuffer must exist while hidden"],"tags":["softbuffer","tiny-skia","nonzero","window-resize","rust"],"backgroundTag":"zero-size-window-dimensions","analyzedSha":"3de451447bd28217bb535632867550908e29d5d0","analyzedAt":"2026-08-17T10:40:26.997Z","contentChangedAt":"2026-08-17T10:40:26.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}