Skip to content

panic resizing closed window using femtovg/wgpu #10166

@kbalt

Description

@kbalt

Bug Description

Using winit and the femtovg renderer with the wgpu backend, makes resizing the window sometimes panic here

let device = device.as_mut().unwrap();

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:renderer-femtovgFemtovg renderer (mS)need triagingIssue that the owner of the area still need to triage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions