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

WeakReference ist sometimes Null in WeakSubscriber #1006

Closed
markus2610 opened this issue Mar 31, 2014 · 6 comments
Closed

WeakReference ist sometimes Null in WeakSubscriber #1006

markus2610 opened this issue Mar 31, 2014 · 6 comments

Comments

@markus2610
Copy link

I used the method bindFragment () when I go repeatedly from activity A to B back and forth is from and to the weak reference to the Subscriber zero.

@vinc3m1
Copy link

vinc3m1 commented Apr 1, 2014

I'm not sure if this is the same issue described above, but we've seen similar issues where using an anonymous function will result in the subscription being GCed because there is only the WeakReference holding it.

The only fix so far is to hold a hard reference to the subscription in the Fragment or Activity (and consequently unsubscribing in ondestroy) which kind of defeats the purpose of OperatorWeakBinding and bindFragment over fromFragment.

I'm not sure if there's a good solution since holding a hard ref to the subscription usually means holding a ref indirectly to the fragment as well.
cc @Bencodes

@markus2610
Copy link
Author

If I have understood you correctly, they use fromFragment instead bindFragement, but the method is deprecated.

@samueltardieu
Copy link
Contributor

Isn't this similar to #979? (I think it is, and we should discuss possible solutions there)

@vinc3m1
Copy link

vinc3m1 commented Apr 1, 2014

Ah yes, it's the same as 979 in my case. I'm not sure if that's what @markus2610 is also talking about.

@markus2610
Copy link
Author

Yes I did mean it.

@benjchristensen
Copy link
Member

I believe this was fixed due to #1021 so closing. If not, please re-open with details on what is left to do.

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

No branches or pull requests

4 participants