slint icon indicating copy to clipboard operation
slint copied to clipboard

Panic when parent of PopupWindow is destroyed: called `Option::unwrap()` on a `None` value

Open lifeRobot opened this issue 11 months ago • 5 comments

slint 1.4.1 when I called PopupWindow. close(), the program panic! I am using third-party components jui/message/confirm at that time,

  1. a thread was changing global properties, see code image
  2. I click jui/confirm components to close PopupWindow, and then the program panic!
  3. see panic! code image image

this issue like: #4500

lifeRobot avatar Feb 27 '24 10:02 lifeRobot

add issue description

  1. I did not use or install qt, I guess it's the default rendering(femtovg or software)

lifeRobot avatar Feb 27 '24 11:02 lifeRobot

Thanks for the report. Do you have some .slint code around that could help us reproduce this?

tronical avatar Feb 27 '24 12:02 tronical

Thanks for the report. Do you have some .slint code around that could help us reproduce this?

yes, I reproduced this question, y can see jui_test example

now I think this may not be a bug, but a problem with the logic of my code

lifeRobot avatar Feb 28 '24 03:02 lifeRobot

Thanks for the report. Do you have some .slint code around that could help us reproduce this?

Supplementary explanation

  1. when testing jui_test, I also found that as long as PopupWindow is opened and the global variable TestGlobal is changed, the jui_test program will painc!
  2. so now I think this may be a bug, because the business logic may change the rendering of components when PopupWindow is displayed, but if we can avoid changing the rendering of PopupWindow components, this issue will not occur

lifeRobot avatar Feb 28 '24 04:02 lifeRobot

Thanks for all the info. This is actually a variant of https://github.com/slint-ui/slint/issues/3464 which is enabled by the PopupWindow. In your example, the parent component of a PopupWindow is destroyed by a timer. but the PopupWindow still exists.

A simpler reproducer is this:

export component Demo  {
    in property <string> text : "Hello";
    in-out property <bool> cond:true;
    if cond : Rectangle {
        p := PopupWindow {
            t := Text { text: root.text; }
        }
        TouchArea {
            clicked => {
                p.show();
                cond = false;
            }
        }
    }
}

ogoffart avatar Mar 07 '24 11:03 ogoffart