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
Validator.registerAdapter() should not be static (or leaks are easy to follow) #97
Comments
You're right. Feel free to send a PR. |
Ok! |
Fixed by 350a42c |
@dimsuz Thank you 👍 |
you are welcome :) |
Thanks for reminding. Just uploaded a new snapshot. |
Great, thank you! |
@ragunathjawahar somehow the current snapshot became |
@dimsuz I have to update my maven publishing script, both |
No, I tried to download directly from the above link. Currently I have |
oh, thank you. didn't know about this! |
One more thing: somehow the change which was fixed by this issue is not present in the snapshot - |
😃 I didn't pull before I uploaded the archives. Can you check now? |
Everything is perfect now :) thanks. |
I beleive that it would be better to make
Validator.registerAdapter()
non-static method.I just had whole
Activity
context leaked because of this method is static.If you do something like this in your activity:
then you automatically leak your Context, because it gets captured by anonymous class.
And using anonymous classes for this kind of things is very common.
So using static here makes it very easy to introduce a leak.
Besides by looking at the sources I don't see why this method needs to be global.
Validator
class seems to be designed to be used in local scope, i.e. inside an activity lifetime, so it seems that registerAdapter should live in that scope too, i.e. be non static.The text was updated successfully, but these errors were encountered: