Skip to content

Commit

Permalink
Merge pull request #228 from takahirom/takahirom/fix-leak-when-multip…
Browse files Browse the repository at this point in the history
…le-compose-captureRoboImage-in-one-test/2023-12-16

Add activityScenario.close() to prevent activity leak
  • Loading branch information
takahirom authored Dec 17, 2023
2 parents 730f2a8 + 394a6c7 commit 481655f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ fun captureRoboImage(
val viewRootForTest = composeView.getChildAt(0) as ViewRootForTest
viewRootForTest.view.captureRoboImage(file, roborazziOptions)
}
// Closing the activity is necessary to prevent memory leaks.
// If multiple captureRoboImage calls occur in a single test,
// they can lead to an activity leak.
activityScenario.close()
}

/**
Expand Down

0 comments on commit 481655f

Please sign in to comment.