Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #105 from augard/master

Fixed ARC leaks
  • Loading branch information...
commit fe01193d263788602015dbc42046b30276e60c84 2 parents 4072978 + 367fce9
Jim Dovey authored
12 AQGridView.xcodeproj/project.pbxproj
View
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 45;
+ objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@@ -212,8 +212,11 @@
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ };
buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "AQGridView" */;
- compatibilityVersion = "Xcode 3.1";
+ compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
@@ -285,7 +288,6 @@
COPY_PHASE_STRIP = NO;
DSTROOT = /tmp/AQGridView.dst;
GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -295,6 +297,7 @@
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PRODUCT_NAME = AQGridView;
+ SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -313,6 +316,7 @@
INSTALL_PATH = /usr/local/lib;
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PRODUCT_NAME = AQGridView;
+ SKIP_INSTALL = YES;
};
name = Release;
};
@@ -326,7 +330,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
OTHER_LDFLAGS = "-ObjC";
- PREBINDING = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
@@ -341,7 +344,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
OTHER_LDFLAGS = "-ObjC";
- PREBINDING = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
10 Classes/AQGridView.h
View
@@ -112,7 +112,7 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
NSIndexSet * _animatingIndices;
NSMutableIndexSet * _highlightedIndices;
- UIView * _touchedContentView; // weak reference
+ UIView * __unsafe_unretained _touchedContentView; // weak reference
UIView * _backgroundView;
UIColor * _separatorColor;
@@ -151,10 +151,10 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
unsigned delegateWillDisplayCell:1;
unsigned delegateWillSelectItem:1;
- unsigned delegateWillSelectItemMultiTouch:1;
+ unsigned delegateWillSelectItemMultiTouch:1;
unsigned delegateWillDeselectItem:1;
unsigned delegateDidSelectItem:1;
- unsigned delegateDidSelectItemMultiTouch:1;
+ unsigned delegateDidSelectItemMultiTouch:1;
unsigned delegateDidDeselectItem:1;
unsigned delegateGestureRecognizerActivated:1;
unsigned delegateAdjustGridCellFrame:1;
@@ -168,8 +168,8 @@ extern NSString * const AQGridViewSelectionDidChangeNotification;
} _flags;
}
-@property (nonatomic, assign) IBOutlet id<AQGridViewDataSource> dataSource;
-@property (nonatomic, assign) IBOutlet id<AQGridViewDelegate> delegate;
+@property (nonatomic, unsafe_unretained) IBOutlet id<AQGridViewDataSource> dataSource;
+@property (nonatomic, unsafe_unretained) IBOutlet id<AQGridViewDelegate> delegate;
@property (nonatomic, assign) AQGridViewLayoutDirection layoutDirection;
67 Classes/AQGridView.m
View
@@ -88,7 +88,6 @@ - (void) deleteVisibleCell: (AQGridViewCell *) cell atIndex: (NSUInteger) visibl
@interface AQGridView ()
@property (nonatomic, copy) NSIndexSet * animatingIndices;
-- (void) cellUpdateAnimationStopped: (NSString *) animationID finished: (BOOL) finished context: (void *) context;
@end
@@ -908,8 +907,8 @@ - (void) setupUpdateAnimations
- (void) endUpdateAnimations
{
NSAssert([_updateInfoStack lastObject] != nil, @"_updateInfoStack should not be empty at this point" );
-
- AQGridViewUpdateInfo * info = [_updateInfoStack lastObject];
+
+ __block AQGridViewUpdateInfo * info = [_updateInfoStack lastObject];
if ( info.numberOfUpdates == 0 )
{
@@ -931,46 +930,34 @@ - (void) endUpdateAnimations
[NSException raise: NSInternalInconsistencyException format: @"Invalid number of items in AQGridView: Started with %u, added %u, deleted %u. Expected %u items after changes, but got %u", (unsigned)_gridData.numberOfItems, (unsigned)numAdded, (unsigned)numDeleted, (unsigned)expectedItemCount, (unsigned)actualItemCount];
}
- // there's a race condition with the info's removal from the stack if there are no animations taking place,
- // where -cellUpdateAnimationStopped:finished:context: is called immediately, before we've finished with the
- // object. Therefore we retain it while we want to use it, just in case
-
[info cleanupUpdateItems];
_animationCount++;
//NSAssert(_animationCount == 1, @"Stacked animations occurring!!");
-
- [UIView beginAnimations: @"CellUpdates" context: (void*)objc_unretainedPointer(info)];
- [UIView setAnimationDelegate: self];
- [UIView setAnimationDidStopSelector: @selector(cellUpdateAnimationStopped:finished:context:)];
- [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
- [UIView setAnimationDuration: 0.3];
-
- self.animatingCells = [info animateCellUpdatesUsingVisibleContentRect: [self gridViewVisibleBounds]];
-
-
- _gridData = [info newGridViewData];
- if ( _selectedIndex != NSNotFound )
- _selectedIndex = [info newIndexForOldIndex: _selectedIndex];
-
- _reloadingSuspendedCount--;
- [UIView commitAnimations];
-}
-
-- (void) cellUpdateAnimationStopped: (NSString *) animationID finished: (BOOL) finished context: (void *) context
-{
- AQGridViewUpdateInfo * info = (__bridge AQGridViewUpdateInfo *)context;
-
- // if nothing was animated, we don't have to do anything at all
-// if ( self.animatingCells.count != 0 )
- [self fixCellsFromAnimation];
-
- // NB: info becomes invalid at this point
- [_updateInfoStack removeObject: info];
- _animationCount--;
-
- //_reloadingSuspendedCount--;
- if ( _flags.delegateDidEndUpdateAnimation == 1 )
- [self.delegate gridViewDidEndUpdateAnimation: self];
+
+ [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut
+ animations:^(void) {
+ self.animatingCells = [info animateCellUpdatesUsingVisibleContentRect: [self gridViewVisibleBounds]];
+
+
+ _gridData = [info newGridViewData];
+ if ( _selectedIndex != NSNotFound )
+ _selectedIndex = [info newIndexForOldIndex: _selectedIndex];
+
+ _reloadingSuspendedCount--;
+ }
+ completion:^(BOOL finished) {
+ // if nothing was animated, we don't have to do anything at all
+ // if ( self.animatingCells.count != 0 )
+ [self fixCellsFromAnimation];
+
+ // NB: info becomes invalid at this point
+ [_updateInfoStack removeObject: info];
+ _animationCount--;
+
+ //_reloadingSuspendedCount--;
+ if ( _flags.delegateDidEndUpdateAnimation == 1 )
+ [self.delegate gridViewDidEndUpdateAnimation: self];
+ }];
}
- (void) beginUpdates
2  Classes/AQGridViewData.h
View
@@ -40,7 +40,7 @@
@interface AQGridViewData : NSObject <NSCopying, NSMutableCopying>
{
- AQGridView * _gridView; // weak reference
+ AQGridView * __unsafe_unretained _gridView; // weak reference
CGSize _boundsSize;
AQGridViewLayoutDirection _layoutDirection;
CGSize _desiredCellSize; // NB: 'cell' here means a grid cell -- i.e. constant size, tessellating
2  Classes/AQGridViewUpdateInfo.h
View
@@ -72,7 +72,7 @@
NSMutableIndexSet * _onlyMovedIndices;
// needs to ask the grid view for cells
- AQGridView * _gridView; // weak reference
+ AQGridView * __unsafe_unretained _gridView; // weak reference
NSMutableSet * _animatingCells;
}
Please sign in to comment.
Something went wrong with that request. Please try again.