Skip to content

Commit 92b34a9

Browse files
committed
FIXED: needed to use weak macro to support old OS #1161
1 parent 9b7e346 commit 92b34a9

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Core/Source/DTAttributedTextContentView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ - (void)drawRect:(CGRect)rect
504504

505505
- (void)relayoutText
506506
{
507-
__weak typeof(self) weakSelf = self;
507+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
508508
DTBlockPerformSyncIfOnMainThreadElseAsync(^{
509509
DTAttributedTextContentView *strongSelf = weakSelf;
510510
// Make sure we actually have a superview and a previous layout before attempting to relayout the text.

Core/Source/DTAttributedTextView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ - (void)scrollRangeToVisible:(NSRange)range animated:(BOOL)animated
130130

131131
- (void)relayoutText
132132
{
133-
__weak typeof(self) weakSelf = self;
133+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
134134
DTBlockPerformSyncIfOnMainThreadElseAsync(^{
135135
DTAttributedTextView *strongSelf = weakSelf;
136136

@@ -168,7 +168,7 @@ - (CGRect)cursorRectAtIndex:(NSInteger)index
168168
#pragma mark Notifications
169169
- (void)contentViewDidLayout:(NSNotification *)notification
170170
{
171-
__weak typeof(self) weakSelf = self;
171+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
172172
DTBlockPerformSyncIfOnMainThreadElseAsync(^{
173173
DTAttributedTextView *strongSelf = weakSelf;
174174

Core/Source/DTHTMLAttributedStringBuilder.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ - (BOOL)_buildString
345345
// don't remove spaces at end of document
346346
_preserverDocumentTrailingSpaces = [[_options objectForKey:DTDocumentPreserveTrailingSpaces] boolValue];
347347

348-
__weak typeof(self) weakSelf = self;
348+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
349349
__block BOOL result;
350350
dispatch_group_async(_dataParsingGroup, _dataParsingQueue, ^{ result = [weakSelf.self->_parser parse]; });
351351

@@ -702,7 +702,7 @@ - (void)_registerTagEndHandlers
702702

703703
- (void)parser:(DTHTMLParser *)parser didStartElement:(NSString *)elementName attributes:(NSDictionary *)attributeDict
704704
{
705-
__weak typeof(self) weakSelf = self;
705+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
706706
dispatch_group_async(_treeBuildingGroup, _treeBuildingQueue, ^{
707707
DTHTMLAttributedStringBuilder *strongSelf = weakSelf;
708708

@@ -814,7 +814,7 @@ - (void)parser:(DTHTMLParser *)parser didStartElement:(NSString *)elementName at
814814
- (void)parser:(DTHTMLParser *)parser didEndElement:(NSString *)elementName
815815
{
816816

817-
__weak typeof(self) weakSelf = self;
817+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
818818
dispatch_group_async(_treeBuildingGroup, _treeBuildingQueue, ^{
819819
@autoreleasepool {
820820
DTHTMLAttributedStringBuilder *strongSelf = weakSelf;
@@ -904,7 +904,7 @@ - (void)parser:(DTHTMLParser *)parser didEndElement:(NSString *)elementName
904904

905905
- (void)parser:(DTHTMLParser *)parser foundCharacters:(NSString *)string
906906
{
907-
__weak typeof(self) weakSelf = self;
907+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
908908
dispatch_group_async(_treeBuildingGroup, _treeBuildingQueue, ^{
909909
DTHTMLAttributedStringBuilder *strongSelf = weakSelf;
910910
if (strongSelf->_ignoreParseEvents)
@@ -971,7 +971,7 @@ - (void)parser:(DTHTMLParser *)parser foundCharacters:(NSString *)string
971971

972972
- (void)parser:(DTHTMLParser *)parser foundCDATA:(NSData *)CDATABlock
973973
{
974-
__weak typeof(self) weakSelf = self;
974+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
975975
dispatch_group_async(_treeBuildingGroup, _treeBuildingQueue, ^{
976976
DTHTMLAttributedStringBuilder *strongSelf = weakSelf;
977977

@@ -993,7 +993,7 @@ - (void)parser:(DTHTMLParser *)parser foundCDATA:(NSData *)CDATABlock
993993

994994
- (void)parserDidEndDocument:(DTHTMLParser *)parser
995995
{
996-
__weak typeof(self) weakSelf = self;
996+
DT_WEAK_VARIABLE typeof(self) weakSelf = self;
997997
dispatch_group_async(_treeBuildingGroup, _treeBuildingQueue, ^{
998998
DTHTMLAttributedStringBuilder *strongSelf = weakSelf;
999999

Demo/Source/AutoLayoutDemoViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@interface AutoLayoutDemoViewController ()
1212

13-
@property (nonatomic, weak) IBOutlet DTAttributedTextContentView *textView;
13+
@property (nonatomic, DT_WEAK_PROPERTY) IBOutlet DTAttributedTextContentView *textView;
1414
@end
1515

1616
@implementation AutoLayoutDemoViewController
@@ -24,4 +24,4 @@ - (void)viewDidLoad {
2424
self.textView.attributedString = [[NSAttributedString alloc] initWithHTMLData:data documentAttributes:NULL];
2525
}
2626

27-
@end
27+
@end

0 commit comments

Comments
 (0)