Skip to content

Live preview crashes with PopupWindow #7775

Closed as duplicate of#6426
Closed as duplicate of#6426
@petiaccja

Description

@petiaccja

Bug Description

Live preview crashes with PopupWindow:

thread 'main' panicked at internal\interpreter\eval.rs:1842:71:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 9:00:33 PM] Connection to server got closed. Server will restart.
true
The Slint Language Server crashed. This is a bug. Please open an issue on https://github.com/slint-ui/slint/issues
[Error - 9:00:33 PM] Server process exited with code 3221226505.

Steps to reproduce (see code below):

  1. Launch LivePreviewTest in live preview using VSCode's inline actions
  2. Click "Show warning" on the live preview window
  3. Click either "Continue" or "Cancel"
  4. Panic

Unfortunately I don't have the stacktrace as I'm not sure how to get it with the live preview. I haven't had the chance yet to test the Slint code by running the Rust application itself. I'm also unsure if the rest of the Slint code affects the live preview for these two files, but I would guess not.

Reproducible Code (if applicable)

// File "prototype_popup.slint"
import { Palette } from "std-widgets.slint";

export component PrototypePopup inherits PopupWindow {
    Rectangle {
        background: Palette.background;
        border-radius: 16px;
        drop-shadow-color: #00000080;
        drop-shadow-blur: 12px;
        drop-shadow-offset-x: 2px;
        drop-shadow-offset-y: 2px;
        opacity: 95%;
    }

    Rectangle {
        background: Palette.control-background;
        border-radius: 16px;
        opacity: 95%;
    }
}

// File "warning_popup.slint"
import { PrototypePopup } from "prototype_popup.slint";
import { Button } from "std-widgets.slint";

export component WarningPopup inherits PrototypePopup {
    width: 400px;
    height: self.min-height;
    in property <bool> continue-enabled: true;
    in property <bool> cancel-enabled: true;
    in property <string> continue-text: "Continue";
    in property <string> cancel-text: "Cancel";
    callback continued();
    callback cancelled();
    content := VerticalLayout {
        spacing: 12px;
        padding: 12px;
        HorizontalLayout {
            alignment: center;
            spacing: 6px;
            VerticalLayout {
                alignment: center;
                // Redacted (does not change behavior)
            }

            @children
        }

        HorizontalLayout {
            alignment: end;
            spacing: 6px;
            if root.continue-enabled: Button {
                text: root.continue-text;
                width: 96px;
                clicked => {
                    root.close();
                    root.continued();
                }
            }
            if root.cancel-enabled: Button {
                text: root.cancel-text;
                width: 96px;
                clicked => {
                    root.close();
                    root.cancelled();
                }
            }
        }
    }
}

export component LivePreviewTest {
    warning := WarningPopup {
        x: (root.width - self.width) / 2;
        y: (root.height - self.height) / 2;
        Text {
            text: "Bad things might happen!";
        }
    }

    Button {
        text: "Show warning";
        clicked => {
            warning.show();
        }
    }
}

Environment Details

  • Slint Version: 1.9.2
  • Platform/OS: Windows 11
  • Programming Language: Slint (live preview)
  • Backend/Renderer: live preview default
  • VSCode Extension Version: 1.10.0

Product Impact

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:language-interpretedInterpreter implementation and Rust API for it (slint-interpreter crate) (mO,bT)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