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

Context leaks on activity recreation #24

Open
4 tasks done
franciscofranco opened this issue Apr 17, 2017 · 2 comments
Open
4 tasks done

Context leaks on activity recreation #24

franciscofranco opened this issue Apr 17, 2017 · 2 comments
Labels
bug Something isn't working

Comments

@franciscofranco
Copy link

  • I have verified there are no duplicate active or recent bugs, questions, or requests.
  • I have verified that I am using the latest version of PiracyChecker.
  • I have given my issue a non-generic title.
  • I have read over the documentation (before asking questions on how to do something).
Details
  • PiracyChecker version: 1.1
  • Device OS version: 7.1.2
  • Device Manufacturer: Huawei
  • Device Name: Nexus 6P
Reproduction Steps
  1. Open the app
  2. Rotate the activity
Expected Result

Activity's instance shouldn't be retained & duplicated.

Actual Result

Activity's context leak.

Maybe put it inside a WeakReference, that way it'll be garbage collected if the activity isn't valid anymore. You can use LeakCanary to double check on actvity leaks.

@javiersantos javiersantos added the possible bug It may be a bug, but it hasn't been reproduced yet label Apr 17, 2017
@franciscofranco
Copy link
Author

franciscofranco commented Apr 17, 2017

Possible fix, call PiracyChecker.destroy() before super.onDestroy(); and it clears up the Activity reference. Doing that and I can't reproduce the issue anymore.
Since that part isn't taken care by the library maybe add that in the ReadMe since it isn't very clear.

@Override
protected void onDestroy() {
    PiracyChecker.destroy();
    super.onDestroy();
}

@javiersantos javiersantos added bug Something isn't working and removed possible bug It may be a bug, but it hasn't been reproduced yet labels Apr 17, 2017
@franciscofranco
Copy link
Author

After some testing even in some cases the context that's referenced through the ResultListener isn't cleared even after destroying it through PiracyChecker.destroy();
This https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/LibraryChecker.java#L306 needs to be static or make it an outter class independent of LibraryChecker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants