Android.Play.ExpansionLibrary
Android.Play.ExpansionLibrary copied to clipboard
ObjectDisposedException when exiting an application
OnDestroy()
of the main activity calls LicenseChecker.OnDestroy()
but that one throws an unhandled ObjectDisposedException
. It happens when the code tries to access the Looper
property on the handler
field. The looper seems to be already gone. As a result, the application crashes.
Interestingly, although the bug is quite reproducible, it only happens on some handset types with a specific Android version, and only in release builds. I suspect it is a timing issue.
Short term solution: Quit the looper through the HandlerThread (PR attached).
Long term solution: replace the Android thread with .NET tasks.