slint/internal/compiler/generator
Olivier Goffart 9289940371 Prospective panic fix in the rust generated code
From the v1.11.0 crash reporter:
There is a panic in
`target/x86_64-unknown-linux-gnu/release/build/slint-lsp-8494405be069a534/out/main.rs:115729:64`
```
called `Result::unwrap()` on an `Err` value: Other("Could not initialize any renderer for LinuxKMS <REDACTED: user-file-path> from Skia renderer: Error opening device <REDACTED: user-file-path>: No such file or directory (os error 2)\\nError from FemtoVG renderer: Error reading DRM resource handles: Permission denied (os error 13)\\nError from Software renderer: Error opening device <REDACTED: user-file-path>: No such file or directory (os error 2)\\nNo renderers configured.")
```

That line in the generated file is in
```
115728   │          fn window_adapter_impl (& self) -> sp :: Rc < dyn sp :: WindowAdapter > {
115729   │              sp :: Rc :: clone (self . window_adapter_ref () . unwrap ()) }
```

Relevant backtrace:
```
6	"core::result::unwrap_failed"
7	"slint_lsp::preview::ui::slint_generatedPreviewUi::PreviewUi::new"
8	"slint_lsp::preview::ui::create_ui"
```

So the theory is that user_init need the window for some reason.
(eg, could be needing the scale factor to conver sizes or some other
things that needs the window)
So make sure we do the test before calling user_init
2025-05-07 09:04:02 +02:00
..
cpp.rs Add Platform.os as well as a rudimentary test 2025-05-06 13:06:27 +02:00
rust.rs Prospective panic fix in the rust generated code 2025-05-07 09:04:02 +02:00