Skip to content

imageCache.clear() in tear down of one test causes usage after disposal in other test. #149288

Closed

Description

@polina-c

I tried to fix leaks in a test by adding imageCache.clear to its tear down , but it broke other test.

Steps:

  1. Find the test 'DecoratedBox handles loading images'
  2. Add line addTearDown(imageCache.clear); somewhere to it
  3. Run flutter test test/widgets/box_decoration_test.dart
  4. See next test failed with usage of image after disposal on await tester.idle();

Activity

  1. changed the title [-]ImageCache.clear() in tear down of one test causes usage after disposal in other test.[/-] [+]imageCache.clear() in tear down of one test causes usage after disposal in other test.[/+] on May 30, 2024
  2. added
    a: leak trackingIssues and PRs related to memory leaks detected by leak_tracker
    on May 30, 2024
  3. added
    a: tests"flutter test", flutter_test, or one of our tests
    frameworkflutter/packages/flutter repository. See also f: labels.
    on May 30, 2024
  4. added
    P2Important issues not at the top of the work list
    on Jun 4, 2024
  5. github-actions commented on Jun 21, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: leak trackingIssues and PRs related to memory leaks detected by leak_trackera: tests"flutter test", flutter_test, or one of our testsframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions