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

Fix some memory leak issues #468

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 9 additions & 11 deletions Alcatraz/Helpers/ATZDownloader.m
Expand Up @@ -25,7 +25,7 @@

@interface ATZDownloader()
@property (strong, nonatomic) NSMutableDictionary *callbacks;
@property (strong, nonatomic) NSURLSession *urlSession;
@property (strong, nonatomic, readonly) NSURLSession *urlSession;
@end


Expand Down Expand Up @@ -135,16 +135,14 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
#pragma mark - Private

- (NSURLSession *)urlSession {
if (_urlSession) return _urlSession;

_urlSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
return _urlSession;
static dispatch_once_t onceToken;
static NSURLSession *session = nil;
dispatch_once(&onceToken, ^{
session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
});
return session;
}





@end
1 change: 1 addition & 0 deletions Alcatraz/Helpers/ATZStyleKit.m
Expand Up @@ -99,6 +99,7 @@ + (void)drawText:(NSString*)text withColor:(NSColor *)color centeredInRect:(NSRe
CGPathRef clippingPath = CGPathCreateWithRect(clippingRect, NULL);
CGContextAddPath(context, clippingPath);
CGContextClip(context);
CFRelease(clippingPath);

NSMutableParagraphStyle* textStyle = NSMutableParagraphStyle.defaultParagraphStyle.mutableCopy;
textStyle.alignment = NSCenterTextAlignment;
Expand Down