Fix leak of display mode
This commit is contained in:
parent
3440b7c0fb
commit
856ecd6235
|
@ -26,7 +26,7 @@ static void * SDWebImageDownloaderOperationKey = &SDWebImageDownloaderOperationK
|
|||
BOOL SDWebImageDownloaderOperationGetCompleted(id<SDWebImageDownloaderOperation> operation) {
|
||||
NSCParameterAssert(operation);
|
||||
NSNumber *value = objc_getAssociatedObject(operation, SDWebImageDownloaderOperationKey);
|
||||
if (value) {
|
||||
if (value != nil) {
|
||||
return value.boolValue;
|
||||
} else {
|
||||
return NO;
|
||||
|
|
|
@ -116,9 +116,14 @@ static CFTimeInterval CACurrentMediaTime(void)
|
|||
// Supports Pro display 120Hz
|
||||
CGDirectDisplayID display = CVDisplayLinkGetCurrentCGDisplay(_displayLink);
|
||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(display);
|
||||
double refreshRate = CGDisplayModeGetRefreshRate(mode);
|
||||
if (refreshRate > 0) {
|
||||
duration = 1.0 / refreshRate;
|
||||
if (mode) {
|
||||
double refreshRate = CGDisplayModeGetRefreshRate(mode);
|
||||
if (refreshRate > 0) {
|
||||
duration = 1.0 / refreshRate;
|
||||
} else {
|
||||
duration = kSDDisplayLinkInterval;
|
||||
}
|
||||
CGDisplayModeRelease(mode);
|
||||
} else {
|
||||
duration = kSDDisplayLinkInterval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue