-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prevent MainActivity from leaking through the DrawerImageLoader singl…
…eton (#4153) Another fix for a memory leak. This one is not as big as #4150, but still worth fixing for memory constrained devices imo. The `DrawerImageLoader` implementation (a global singleton) references a member of the `MainActivity`, causing the whole activity to leak. This weird construct was introduced in #1989 to fix a crash, but I think since we migrated to coroutines it is no longer necessary because all calls get correctly cancelled. I tried reproducing the crash but could not, so I'm pretty sure it is fine. I would appreciate it if someone else could try it as well though. (The crash could be reproduced on slow internet, when `onFetchUserInfoSuccess` was called while the activity was being destroyed, causing Glide to crash the app because it can't use destroyed activities. `onFetchUserInfoSuccess` is now no longer called in this case because it is inside a `lifecycleScope.launch` block.)
- Loading branch information
Showing
1 changed file
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters