This repository has been archived by the owner on Jun 1, 2024. It is now read-only.
Misuse of AsyncTask #3051
Labels
Bug
This is an issue with Slide. This is where something in the app isn't working as intended.
Good First Issue
This issue is perfect for you if you are new to Slide.
Has Solution
There is a solution to this issue posted in the comment.
According to our research, there are misuses about the following classes:
me.ccrama.redditslide.Vote
me.ccrama.redditslide.Activities.CommentsScreenSingle.AsyncGetSubredditName
me.ccrama.redditslide.Activities.Inbox
me.ccrama.redditslide.Activities.LiveThread
The problems are:
LiveThread
andInbox
. They hold strong reference to the GUI element of Activity, which can lead to memory leak when the Activity is destroyed and the AsyncTask did not finish. Similar problem also exists inVote
andAsyncGetSubredditName
.I think we can make following changes to fix the misuse problems:
private View v
inVote
as example, it can be changed tpprivate WeakReference<view> v
. Besides, use non-anonymous inner static classes to replace these annoymous classes.cancel()
in the onDestroy() method of Activities.These are my suggestions above, thank you.
The text was updated successfully, but these errors were encountered: