Move clearing out of ASTextKitComponents property delegates into ASTextKitComponents dealloc (#591)

This commit is contained in:
Michael Schneider
2017-09-30 07:20:14 -07:00
committed by GitHub
parent 5186a4317e
commit 5c6cd7c8d9
2 changed files with 14 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
//
// ASTextKitComponents.m
// ASTextKitComponents.mm
// Texture
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
@@ -30,6 +30,8 @@
@implementation ASTextKitComponents
#pragma mark - Class
+ (instancetype)componentsWithAttributedSeedString:(NSAttributedString *)attributedSeedString
textContainerSize:(CGSize)textContainerSize
{
@@ -58,6 +60,17 @@
return components;
}
#pragma mark - Lifecycle
- (void)dealloc
{
// Nil out all delegate to prevent crash
_textView.delegate = nil;
_layoutManager.delegate = nil;
}
#pragma mark - Sizing
- (CGSize)sizeForConstrainedWidth:(CGFloat)constrainedWidth
{
ASTextKitComponents *components = self;