Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] new TransitionDrawable memory leak #10

Merged
merged 1 commit into from Apr 21, 2018

Conversation

buptfarmer
Copy link
Contributor

[bugfix] new TransitionDrawable point to old drawable array, which cause memory leak

As we know, TransitionDrawable is a LayerDrawable which contains a array of two drawables need to do transition. But directly use old drawable to create new TransitionDrawable, let the the newly created TransitionDrawable hold a reference to the old array rather than the only drawable.

placeholder = imageView.getDrawable();

So I break the reference chain and fix like this:

                                Drawable oldDrawable = imageView.getDrawable();
                                if (oldDrawable != null) {
                                    if (oldDrawable instanceof LayerDrawable) {
                                        LayerDrawable oldLayerDrawable = (LayerDrawable) oldDrawable;
                                        placeholder = oldLayerDrawable.getDrawable(0);
                                    } else {
                                        placeholder = imageView.getDrawable();
                                    }
                                } 

Please review that, and I hope you may accept this pr.

@patrickfav
Copy link
Owner

Hi buptfarmer, thanks for the PR, will review in the next couple of days :)
Dont worry about the failing build, currently PR branches miss the private keys. Have to find a workaround in the future.

@patrickfav patrickfav merged commit 0348196 into patrickfav:master Apr 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants