-
Notifications
You must be signed in to change notification settings - Fork 28
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
Event observers in fragments are leaked when fragment is removed from activity #161
Comments
Are you removing the Fragment via |
Mostly by |
Hmm, the Fragment should be going through the "reverse series of callbacks" when it is "no longer used": http://developer.android.com/reference/android/app/Fragment.html#Lifecycle which includes I'll have to investigate this a bit more to see what and if we should change. We should register and unregister in one specific, guaranteed callback respectively. BTW, looking at Otto's example, it seems they also unregister in the |
I have looked at this once again and the problem apparently was with the fact that I was removing parent fragment without removing fragments embedded into it. So onPause was called for parent fragment, but wasn't called for child fragments. |
Okay, the issue was that I was using injected |
Good deal. I do appreciate the post even if it is a false alarm. Keep the input coming! |
Absolutely. We would just need to add it to the FragmentPlugin. How would you like to inject it? We could specify a qualifier annotation for this injection since htere are many different types of FragmentManagers: |
As you see it fit :) |
As event observers are registered in
onResume
and unregistered inonPause
callbacks, if fragment is removed from activity without activity pausing, event observers are not unregistered and are left hanging, leaking fragment and causing unwanted effects when the event is triggered.Maybe we should additionally unregister event handlers in
onDestroy
?The text was updated successfully, but these errors were encountered: