Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 0849223240be9c719dc8743358ce208f437c99bb 1 parent c0953f1
Mark Aufflick aufflick authored

Showing 1 changed file with 6 additions and 14 deletions. Show diff stats Hide diff stats

  1. +6 14 Classes/AQGridView.m
20 Classes/AQGridView.m
@@ -656,9 +656,7 @@ - (void) layoutSubviews
656 656
657 657 if ( (_reloadingSuspendedCount == 0) && (!CGRectIsEmpty([self gridViewVisibleBounds])) )
658 658 {
659   - @autoreleasepool {
660   - [self updateVisibleGridCellsNow];
661   - }
  659 + [self updateVisibleGridCellsNow];
662 660 }
663 661
664 662 if ( _flags.allCellsNeedLayout == 1 )
@@ -1496,19 +1494,13 @@ @implementation AQGridView (AQCellLayout)
1496 1494
1497 1495 - (void) sortVisibleCellList
1498 1496 {
1499   -#warning I have commented out the body of sortVisibleCellList() pending figuring out how to use OSAtomicCompareAndSwapPtrBarrier() with ARC
1500   - // see : https://devforums.apple.com/thread/111141
1501   - /*
1502   - static NSArray * __sortDescriptors = nil;
1503   - if ( __sortDescriptors == nil )
1504   - {
1505   - NSArray * obj = [[NSArray alloc] initWithObjects: [[[NSSortDescriptor alloc] initWithKey: @"displayIndex" ascending: YES] autorelease], nil];
1506   - if ( OSAtomicCompareAndSwapPtrBarrier(nil, obj, (void * volatile *)&__sortDescriptors) == false )
1507   - [obj release]; // already stored by another thread
1508   - }
  1497 + __block NSArray * __sortDescriptors;
  1498 + static dispatch_once_t onceToken;
  1499 + dispatch_once(&onceToken, ^{
  1500 + __sortDescriptors = [[NSArray alloc] initWithObjects: [[NSSortDescriptor alloc] initWithKey: @"displayIndex" ascending: YES], nil];
  1501 + });
1509 1502
1510 1503 [_visibleCells sortUsingDescriptors: __sortDescriptors];
1511   - */
1512 1504 }
1513 1505
1514 1506 - (void) updateGridViewBoundsForNewGridData: (AQGridViewData *) newGridData

0 comments on commit 0849223

Please sign in to comment.
Something went wrong with that request. Please try again.