Skip to content

any_popup_open() remains true even when there are no popups #3657

@juancampa

Description

@juancampa

Describe the bug

If a popup that is being shown is removed without calling Memory::close_popup, egui will think that the popup is still being shown, for example
Memory::any_popup_open() returns true.

Video of the problem:

Screenshot.2024-06-23.at.18.41.41-converted.mp4

You'd think the solution is to always call close_popup() but in some cases that's not practical, for example, the app stops rendering that part of the UI.

Proposed solution: clear Memory::popup at the end of a frame if is_popup_open was not called with the id of the current one (assume the popup was "abandoned"). Probably rename the function to something that reflects this behavior, e.g. retain_popup, check_and_keep_popup_open?

To Reproduce
Steps to reproduce the behavior:

  1. Open a popup (e.g. color picker, drop-down, etc)
  2. Without manually closing the popup, stop rendering it (i.e. don't hit that code path at all)
  3. Memory::any_popup_open() is true

Expected behavior

Memory::any_popup_open() is false

Screenshots

Desktop (please complete the following information):

  • Version 0.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions