Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Clean contentView_ reference in onDestroyView()#1171

Merged
WonderCsabo merged 1 commit into
developandroidannotations/androidannotations:developfrom
unknown repositoryCopy head branch name to clipboard
Sep 29, 2014
Merged

Clean contentView_ reference in onDestroyView()#1171
WonderCsabo merged 1 commit into
developandroidannotations/androidannotations:developfrom
unknown repositoryCopy head branch name to clipboard

Conversation

@ghost

@ghost ghost commented Sep 29, 2014

Copy link
Copy Markdown

If setRetainInstance(true) has been set on the fragment or
addToBackStack() was applied to FragmentTransaction, the fragment won't be
destroyed and will keep the reference to its parent view in contentView_
and could lead to memory leak.

This change implements onDestroyView() which cleans the reference.
However, the developer is still responsible for cleaning up the injected
views, because otherwise a (badly implemented) background task may get a
NullPointerException.

If setRetainInstance(true) has been set on the fragment or
addToBackStack() was applied to FragmentTransaction, the fragment won't be
destroyed and will keep the reference to its parent view in contentView_
and could lead to memory leak.

This change implements onDestroyView() which cleans the reference.
However, the developer is still responsible for cleaning up the injected
views, because otherwise a (badly implemented) background task may get a
NullPointerException.
WonderCsabo added a commit that referenced this pull request Sep 29, 2014
Clean contentView_ reference in onDestroyView()
@WonderCsabo WonderCsabo merged commit 7a45e8b into androidannotations:develop Sep 29, 2014
@WonderCsabo

Copy link
Copy Markdown
Member

Thanks!

@ghost

ghost commented Sep 29, 2014

Copy link
Copy Markdown
Author

Glad to help!

@WonderCsabo WonderCsabo added this to the 3.2 milestone Sep 29, 2014
@ghost ghost deleted the 933_efragment_ondestroyview2 branch September 29, 2014 17:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.