Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Source/Classes/AnimatedImages/PINAnimatedImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,10 @@ - (void)startAnimating
if ([self canBeVisible] == NO) {
return;
}

// Get frame interval before holding display link lock to avoid deadlock
NSUInteger frameInterval = self.animatedImage.frameInterval;

if (_displayLink == nil) {
_playHead = 0;
_displayLink = [PINDisplayLink displayLinkWithTarget:[PINRemoteWeakProxy weakProxyWithTarget:self] selector:@selector(displayLinkFired:)];
_displayLink.frameInterval = frameInterval;
_lastSuccessfulFrameIndex = NSUIntegerMax;

[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.animatedImageRunLoopMode];
Expand Down Expand Up @@ -361,7 +357,7 @@ - (void)displayLinkFired:(PINDisplayLink *)displayLink
_playHead = 0;
_playedLoops++;
}

if (self.animatedImage.loopCount > 0 && _playedLoops >= self.animatedImage.loopCount) {
[self stopAnimating];
return;
Expand Down