Skip to content

Using container.NewThemeOverride leaks memory until window closing #5000

Closed
@dweymouth

Description

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

When adding a widget to a container.NewThemeOverride, the widget and its override theme are stored in the overrides map. This is never cleaned out except when a window is closing. This is because the deletion of the widget's entry in the overrides map happens in cache.DestroyRenderer, but that function is only called when a window is closing. Elsewhere (eg in the regular clean task), renderers are directly destroyed instead of by calling this function, which misses the deletion of the entry from the overrides map, if that widget had a theme override.

How to reproduce

just check the code as described above. Or create an app that cycles through new widgets, applying an override to them, and then not using them. It will leak memory

Screenshots

No response

Example code

n/a

Fyne version

2.5.0

Go compiler version

n/a

Operating system and version

n/a

Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    blockerItems that would block a forthcoming releasebugSomething isn't workingoptimizationTickets that could help Fyne apps run faster

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions