Skip to content

timer not set to nil after invalidated, result in memory leak! #6

@Quanhua-Guan

Description

@Quanhua-Guan

timer not set to nil after invalidated, result in memory leak!

- (void)update
{
    CGFloat animationProggress = self.animationProggress + DAUpdateUIFrequency / self.stateChangeAnimationDuration;
    if (animationProggress >= 1.) {
        self.animationProggress = 1.;
        [self.timer invalidate];
        self.timer = nil;// ADD THIS LINE RESOLVE THE ISSUE
    } else {
        self.animationProggress = animationProggress;
    }
    [self setNeedsDisplay];
}

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