Skip to content

Commit

Permalink
Fix warnings and memory issues (TextureGroup#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
maicki authored and mikezucc committed Oct 2, 2018
1 parent 6a81202 commit c2c776b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Source/ASCGImageBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AS_SUBCLASSING_RESTRICTED
@property (readonly) void *mutableBytes NS_RETURNS_INNER_POINTER;

/// Don't do any drawing or call any methods after calling this.
- (CGDataProviderRef)createDataProviderAndInvalidate;
- (CGDataProviderRef)createDataProviderAndInvalidate CF_RETURNS_RETAINED;

@end

Expand Down
5 changes: 3 additions & 2 deletions Source/ASRunLoopQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ - (void)threadMain
return;
}
// The scope below is entered while already locked. @autorelease is crucial here; see PR 2890.
NSInteger count;
__unused NSInteger count; // Prevent static analyzer warning if release build
@autoreleasepool {
#if ASRunLoopQueueLoggingEnabled
NSLog(@"ASDeallocQueue Processing: %lu objects destroyed", weakSelf->_queue.size());
Expand Down Expand Up @@ -281,7 +281,8 @@ @implementation ASAbstractRunLoopQueue

- (instancetype)init
{
if (self != [super init]) {
self = [super init];
if (self == nil) {
return nil;
}
ASDisplayNodeAssert(self.class != [ASAbstractRunLoopQueue class], @"Should never create instances of abstract class ASAbstractRunLoopQueue.");
Expand Down
4 changes: 3 additions & 1 deletion Source/ASTextNode2.mm
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ - (void)prepareAttributedString:(NSMutableAttributedString *)attributedString
if (_shadowOpacity > 0 && (_shadowRadius != 0 || !CGSizeEqualToSize(_shadowOffset, CGSizeZero)) && CGColorGetAlpha(_shadowColor) > 0) {
NSShadow *shadow = [[NSShadow alloc] init];
if (_shadowOpacity != 1) {
shadow.shadowColor = [UIColor colorWithCGColor:CGColorCreateCopyWithAlpha(_shadowColor, _shadowOpacity * CGColorGetAlpha(_shadowColor))];
CGColorRef shadowColorRef = CGColorCreateCopyWithAlpha(_shadowColor, _shadowOpacity * CGColorGetAlpha(_shadowColor));
shadow.shadowColor = [UIColor colorWithCGColor:shadowColorRef];
CGColorRelease(shadowColorRef);
} else {
shadow.shadowColor = [UIColor colorWithCGColor:_shadowColor];
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/ASCollectionFlowLayoutDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (id)additionalInfoForLayoutWithElements:(ASElementMap *)elements
+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context
{
ASElementMap *elements = context.elements;
NSMutableArray<ASCellNode *> *children = ASArrayByFlatMapping(elements.itemElements, ASCollectionElement *element, element.node);
NSArray<ASCellNode *> *children = ASArrayByFlatMapping(elements.itemElements, ASCollectionElement *element, element.node);
if (children.count == 0) {
return [[ASCollectionLayoutState alloc] initWithContext:context];
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Private/TextExperiment/Component/ASTextLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ - (NSArray *)selectionRectsForRange:(ASTextRange *)range {
range = [self _correctedRangeWithEdge:range];

BOOL isVertical = _container.verticalForm;
NSMutableArray *rects = [[NSMutableArray<NSValue *> alloc] init];
NSMutableArray *rects = [[NSMutableArray<ASTextSelectionRect *> alloc] init];
if (!range) return rects;

NSUInteger startLineIndex = [self lineIndexForPosition:range.start];
Expand Down

0 comments on commit c2c776b

Please sign in to comment.