Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Use HomeFragment's viewLifecycleOwner as the lifecycle for observer registry #10012

Merged
merged 2 commits into from
Apr 17, 2020

Conversation

grigoryk
Copy link
Contributor

If we just use the HomeFragment itself, we end up with a memory leak since the lifecycle events
that would clean up the registry (e.g. destroy) won't run (if the fragment is retained in the backstack, for example).

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

After merge

  • Milestone: Make sure issues finished by this pull request are added to the milestone of the version currently in development.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@grigoryk grigoryk requested a review from ekager April 17, 2020 01:08
…ager observer registry

If we just use the HomeFragment itself, we end up with a memory leak since the lifecycle events
that would clean up the registry (e.g. destroy) won't run (if the fragment is retained in the backstack, for example).
@codecov-io
Copy link

codecov-io commented Apr 17, 2020

Codecov Report

Merging #10012 into master will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #10012      +/-   ##
============================================
- Coverage     19.17%   19.16%   -0.01%     
  Complexity      521      521              
============================================
  Files           336      336              
  Lines         13729    13731       +2     
  Branches       1844     1844              
============================================
  Hits           2632     2632              
- Misses        10857    10859       +2     
  Partials        240      240              
Impacted Files Coverage Δ Complexity Δ
...c/main/java/org/mozilla/fenix/home/HomeFragment.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2056b6f...78066a6. Read the comment docs.

@ekager ekager changed the title Use HomeFragment's viewLifecycleOwner as the lifecycle for accountManager observer registry Use HomeFragment's viewLifecycleOwner as the lifecycle for observer registry Apr 17, 2020
Copy link
Contributor

@ekager ekager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤞🏻 hoping this fixes #9936 but either way happy to fix some memory leaks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants