slint icon indicating copy to clipboard operation
slint copied to clipboard

panic resizing closed window using femtovg/wgpu

Open kbalt opened this issue 1 month ago • 0 comments

Bug Description

Using winit and the femtovg renderer with the wgpu backend, makes resizing the window sometimes panic here https://github.com/slint-ui/slint/blob/dbe2c59ce95b73fb9d236f4c916903405bffb81d/internal/renderers/femtovg/wgpu.rs#L130

This happens when data is modified that affects the window size of the closed/hidden window.

Reproducible Code (if applicable)

use std::rc::Rc;

use slint::{SharedString, VecModel};

slint::slint! {
    import { Button } from "std-widgets.slint";

    export component CrashWindow inherits Window {
        in property <[string]> list;

        callback crash-me();

        VerticalLayout {
            for s in root.list: Rectangle {
                width: 100px;
                height: 100px;
            }

            Button {
                text: "Crash me!";
                clicked => root.crash-me();
            }
        }
    }
}

fn main() {
    let window = CrashWindow::new().unwrap();

    let w = window.clone_strong();
    window.on_crash_me(move || {
        // Close the window
        w.hide().unwrap();
        // Add some data to have the rectangle trigger a resize
        w.set_list(Rc::new(VecModel::from_slice(&[SharedString::new()])).into());
    });

    window.show().unwrap();

    slint::run_event_loop_until_quit().unwrap();
}
[package]
name = "test"
version = "0.1.0"
edition = "2024"

[dependencies]
slint = { version = "1", default-features = false, features = [
    "std",
    "compat-1-2",
    "renderer-femtovg-wgpu",
    "backend-winit",
] }

Environment Details

  • Slint Version: 1.14
  • Platform/OS: Linux/Wayland
  • Programming Language: rust
  • Backend/Renderer: winit femtovg

Product Impact

No response

kbalt avatar Nov 27 '25 01:11 kbalt