From 04ecd4180ecc0705aab0fdfa5be05cec4dd206b9 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Thu, 25 Aug 2016 17:29:31 -0700 Subject: [PATCH] [ASTextKitRenderer] Shift TextKit Teardown onto the Deallocation Queue (#2136) * [ASTextKitRenderer] Shift TextKit teardown onto the deallocation queue * Import it! --- AsyncDisplayKit/TextKit/ASTextKitRenderer.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm b/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm index efaef16ded..2f24f530f9 100755 --- a/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm +++ b/AsyncDisplayKit/TextKit/ASTextKitRenderer.mm @@ -16,6 +16,7 @@ #import "ASTextKitShadower.h" #import "ASTextKitTailTruncater.h" #import "ASTextKitFontSizeAdjuster.h" +#import "ASInternalHelpers.h" //#define LOG(...) NSLog(__VA_ARGS__) #define LOG(...) @@ -129,9 +130,17 @@ static NSCharacterSet *_defaultAvoidTruncationCharacterSet() // truncater do it's job again for the new constrained size. This is necessary as after a truncation did happen // the context would use the truncated string and not the original string to truncate based on the new // constrained size + __block ASTextKitContext *ctx = _context; + __block ASTextKitTailTruncater *tru = _truncater; + __block ASTextKitFontSizeAdjuster *adj = _fontSizeAdjuster; _context = nil; _truncater = nil; _fontSizeAdjuster = nil; + ASPerformBlockOnDeallocationQueue(^{ + ctx = nil; + tru = nil; + adj = nil; + }); } }