JetradarMobile / android-snowfall

Fully customizable implementation of "Snowfall View" on Android.
Apache License 2.0
1.17k stars 173 forks source link

Fix memory leak related to inner HandlerThread #12

Closed ivacf closed 6 years ago

ivacf commented 6 years ago

We were using this library and noticed that it would leak the activity that contains the SnowfallView. This was due to the HandlerThread being an inner class, therefore having a reference to the view.

I also ensured that the thread is not started until the view is attached. And that we call quit() when detached.

I tested the changes with the sample app and the android studio memory analyser.

otopba commented 6 years ago

@ivacf Thank you! You save my day

johnkil commented 6 years ago

@ivacf Thanks for contribution, it is really valuable commit! :+1: