Permalink
Browse files

d'oh - found an easy solution just as gparker was taking me to school!

  • Loading branch information...
1 parent c0953f1 commit 0849223240be9c719dc8743358ce208f437c99bb @aufflick aufflick committed Jul 12, 2011
Showing with 6 additions and 14 deletions.
  1. +6 −14 Classes/AQGridView.m
View
20 Classes/AQGridView.m
@@ -656,9 +656,7 @@ - (void) layoutSubviews
if ( (_reloadingSuspendedCount == 0) && (!CGRectIsEmpty([self gridViewVisibleBounds])) )
{
- @autoreleasepool {
- [self updateVisibleGridCellsNow];
- }
+ [self updateVisibleGridCellsNow];
}
if ( _flags.allCellsNeedLayout == 1 )
@@ -1496,19 +1494,13 @@ @implementation AQGridView (AQCellLayout)
- (void) sortVisibleCellList
{
-#warning I have commented out the body of sortVisibleCellList() pending figuring out how to use OSAtomicCompareAndSwapPtrBarrier() with ARC
- // see : https://devforums.apple.com/thread/111141
- /*
- static NSArray * __sortDescriptors = nil;
- if ( __sortDescriptors == nil )
- {
- NSArray * obj = [[NSArray alloc] initWithObjects: [[[NSSortDescriptor alloc] initWithKey: @"displayIndex" ascending: YES] autorelease], nil];
- if ( OSAtomicCompareAndSwapPtrBarrier(nil, obj, (void * volatile *)&__sortDescriptors) == false )
- [obj release]; // already stored by another thread
- }
+ __block NSArray * __sortDescriptors;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ __sortDescriptors = [[NSArray alloc] initWithObjects: [[NSSortDescriptor alloc] initWithKey: @"displayIndex" ascending: YES], nil];
+ });
[_visibleCells sortUsingDescriptors: __sortDescriptors];
- */
}
- (void) updateGridViewBoundsForNewGridData: (AQGridViewData *) newGridData

0 comments on commit 0849223

Please sign in to comment.