Skip to content

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

@code-n-roll

Description

@code-n-roll

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions