Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
[ASTableView] Add retainedLayer a la collection view (#1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlai Holler authored and Adlai Holler committed Jul 19, 2016
1 parent 5e52d8c commit 47daafa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions AsyncDisplayKit/ASTableView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "ASTableViewInternal.h"

#import "ASAssert.h"
#import "ASAvailability.h"
#import "ASBatchFetching.h"
#import "ASCellNode+Internal.h"
#import "ASChangeSetDataController.h"
Expand Down Expand Up @@ -111,6 +112,15 @@ @interface ASTableView () <ASRangeControllerDataSource, ASRangeControllerDelegat
CGFloat _contentOffsetAdjustment;

CGPoint _deceleratingVelocity;

/**
* Our layer, retained. Under iOS < 9, when table views are removed from the hierarchy,
* their layers may be deallocated and become dangling pointers. This puts the table view
* into a very dangerous state where pretty much any call will crash it. So we manually retain our layer.
*
* You should never access this, and it will be nil under iOS >= 9.
*/
CALayer *_retainedLayer;

CGFloat _nodesConstrainedWidth;
BOOL _ignoreNodesConstrainedWidthChange;
Expand Down Expand Up @@ -235,6 +245,10 @@ - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataC
self.strongTableNode = tableNode;
}

if (!AS_AT_LEAST_IOS9) {
_retainedLayer = self.layer;
}

return self;
}

Expand Down

0 comments on commit 47daafa

Please sign in to comment.