Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
Wrap in autorelease pool.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchest committed Oct 21, 2014
1 parent 04f089e commit ece9597
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions GeneratePreviewForURL.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
}
CGFloat width = CGImageGetWidth(image);
CGFloat height = CGImageGetHeight(image);
NSDictionary *newOpt = [NSDictionary dictionaryWithObjectsAndKeys:(NSString *)[(NSDictionary *)options objectForKey:(NSString *)kQLPreviewPropertyDisplayNameKey], kQLPreviewPropertyDisplayNameKey, [NSNumber numberWithFloat:width], kQLPreviewPropertyWidthKey, [NSNumber numberWithFloat:height], kQLPreviewPropertyHeightKey, nil];
CGContextRef ctx = QLPreviewRequestCreateContext(preview, CGSizeMake(width, height), YES, (CFDictionaryRef)newOpt);
CGContextDrawImage(ctx, CGRectMake(0,0,width,height), image);
QLPreviewRequestFlushContext(preview, ctx);
CGImageRelease(image);
CGContextRelease(ctx);

@autoreleasepool {
NSDictionary *newOpt = [NSDictionary dictionaryWithObjectsAndKeys:(NSString *)[(NSDictionary *)options objectForKey:(NSString *)kQLPreviewPropertyDisplayNameKey], kQLPreviewPropertyDisplayNameKey, [NSNumber numberWithFloat:width], kQLPreviewPropertyWidthKey, [NSNumber numberWithFloat:height], kQLPreviewPropertyHeightKey, nil];
CGContextRef ctx = QLPreviewRequestCreateContext(preview, CGSizeMake(width, height), YES, (CFDictionaryRef)newOpt);
CGContextDrawImage(ctx, CGRectMake(0,0,width,height), image);
QLPreviewRequestFlushContext(preview, ctx);
CGImageRelease(image);
CGContextRelease(ctx);
}
return noErr;
}

Expand Down

0 comments on commit ece9597

Please sign in to comment.