DotLoadersPack-Android icon indicating copy to clipboard operation
DotLoadersPack-Android copied to clipboard

Bug: multiple onVisibleChanged calls on LinearDotsLoader leads to multiple scheduled Timer instances

Open code-n-roll opened this issue 3 years ago • 0 comments

bug in these lines https://github.com/agrawalsuneet/DotLoadersPack-Android/blob/master/dotsloader/src/main/java/com/agrawalsuneet/dotsloader/loaders/LinearDotsLoader.kt#L90-L98

fix is to add cancelling before timer instantiation and scheduling to eliminate racing of cancel vs create&schedule.

private fun scheduleTimer() {
        timer?.cancel()
        timer = Timer()

Reproducible when I created multiple LinearDotsLoader programmatically and one by one show/hide them.

code-n-roll avatar Nov 08 '22 18:11 code-n-roll