File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,20 @@ - (void)setTextStorage:(NSTextStorage *)textStorage
115
115
contentFrame : (CGRect)contentFrame
116
116
descendantViews : (NSArray <UIView *> *)descendantViews
117
117
{
118
+ #if TARGET_OS_OSX // [TODO(macOS ISS#2323203)
119
+ // On macOS when a large number of flex layouts are being performed, such
120
+ // as when a window is being resized, AppKit can throw an uncaught exception
121
+ // (-[NSConcretePointerArray pointerAtIndex:]: attempt to access pointer at index ...)
122
+ // during the dealloc of NSLayoutManager. The _textStorage and its
123
+ // associated NSLayoutManager dealloc later in an autorelease pool.
124
+ // Manually removing the layout manager from _textStorage prior to release
125
+ // works around this issue in AppKit.
126
+ NSArray <NSLayoutManager *> *managers = [_textStorage layoutManagers ];
127
+ for (NSLayoutManager *manager in managers) {
128
+ [_textStorage removeLayoutManager: manager];
129
+ }
130
+ #endif // ]TODO(macOS ISS#2323203)
131
+
118
132
_textStorage = textStorage;
119
133
_contentFrame = contentFrame;
120
134
You can’t perform that action at this time.
0 commit comments