Skip to content

fix: memory leaks [DeckPicker + CardBrowser]#21149

Merged
lukstbit merged 3 commits into
ankidroid:mainfrom
david-allison:21148-memory-leaks
May 27, 2026
Merged

fix: memory leaks [DeckPicker + CardBrowser]#21149
lukstbit merged 3 commits into
ankidroid:mainfrom
david-allison:21148-memory-leaks

Conversation

@david-allison
Copy link
Copy Markdown
Member

Fixes

Approach

How Has This Been Tested?

  • Enable leak canary
  • Open the deck picker + 'change order' dialogs, then change screens

Learning (optional, can help others)

viewTreeObserver internals: if called before the attach phase, a 'floating' tree observer is attached, and copied out when the real tree observer is added, this means onDestroy() isn't an ideal location.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

matching the 'setup' pattern in our new screens
Fixed by moving to a 'scroll' listener on the RecyclerView

I decided not to use onDestroy() - pullToSyncWrapper is not yet
attached in onCreate, so it would need `addOnAttachStateChangeListener`
 - too complex

Fixes 21148

Assisted-by: Claude Opus 4.7 - diagnostics
Fixes a TODO and moves the operation into the ViewModel
 - orderSingleChoiceDialogListener was in the companion object

Fixes 21148

Assisted-by: Claude Opus 4.7 - all
@david-allison david-allison changed the title fix: menory leaks [DeckPicker + CardBrowser] fix: memory leaks [DeckPicker + CardBrowser] May 26, 2026
Copy link
Copy Markdown
Contributor

@criticalAY criticalAY left a comment

Choose a reason for hiding this comment

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

Thankyou! Looks great

@criticalAY criticalAY added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels May 26, 2026
@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels May 27, 2026
@lukstbit lukstbit added this pull request to the merge queue May 27, 2026
Merged via the queue into ankidroid:main with commit 7594d0d May 27, 2026
20 checks passed
@github-actions github-actions Bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label May 27, 2026
@github-actions github-actions Bot added this to the 2.25 release milestone May 27, 2026
@david-allison david-allison deleted the 21148-memory-leaks branch May 27, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak in deck picker

3 participants