Fix a crash, when SDAnimatedImageView dealloc, displayLinkContext in block will be a bad pointer
This commit is contained in:
parent
d9c8ba6da2
commit
d85f94da96
|
@ -742,8 +742,10 @@ static CVReturn renderCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *
|
||||||
// Calculate refresh duration
|
// Calculate refresh duration
|
||||||
NSTimeInterval duration = (double)inOutputTime->videoRefreshPeriod / ((double)inOutputTime->videoTimeScale * inOutputTime->rateScalar);
|
NSTimeInterval duration = (double)inOutputTime->videoRefreshPeriod / ((double)inOutputTime->videoTimeScale * inOutputTime->rateScalar);
|
||||||
// CVDisplayLink callback is not on main queue
|
// CVDisplayLink callback is not on main queue
|
||||||
|
SDAnimatedImageView *imageView = (__bridge SDAnimatedImageView *)displayLinkContext;
|
||||||
|
__weak SDAnimatedImageView *weakImageView = imageView;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[(__bridge SDAnimatedImageView *)displayLinkContext displayDidRefresh:displayLink duration:duration];
|
[weakImageView displayDidRefresh:displayLink duration:duration];
|
||||||
});
|
});
|
||||||
return kCVReturnSuccess;
|
return kCVReturnSuccess;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue