mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Prevent UITextView from updating contentOffset while deallocating (#915)
* Prevent UITextView from updating contentOffset while deallocating * Add comment on the flag point to the issue
This commit is contained in:
committed by
GitHub
parent
4171e767be
commit
efe924cca7
@@ -48,6 +48,7 @@
|
||||
- Adds an experiment to shorten init time. [Adlai Holler](https://github.com/Adlai-Holler)
|
||||
- Adds a check that Texture is compiled with stdc++11 as specified by the podfile. gnu++11 can cause subtle issues that are currently being investigated. [Adlai Holler](https://github.com/Adlai-Holler)
|
||||
- Adds an experiment to call ASNetworkImageNode callbacks off main. [Garrett Moon](https://github.com/garrettmoon)
|
||||
- Prevent UITextView from updating contentOffset while deallocating [Michael Schneider](https://github.com/maicki)
|
||||
|
||||
## 2.6
|
||||
- [Xcode 9] Updated to require Xcode 9 (to fix warnings) [Garrett Moon](https://github.com/garrettmoon)
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
|
||||
#import <tgmath.h>
|
||||
|
||||
@interface ASTextKitComponentsTextView ()
|
||||
@interface ASTextKitComponentsTextView () {
|
||||
// Prevent UITextView from updating contentOffset while deallocating: https://github.com/TextureGroup/Texture/issues/860
|
||||
BOOL _deallocating;
|
||||
}
|
||||
@property (atomic, assign) CGRect threadSafeBounds;
|
||||
@end
|
||||
|
||||
@@ -31,10 +34,16 @@
|
||||
self = [super initWithFrame:frame textContainer:textContainer];
|
||||
if (self) {
|
||||
_threadSafeBounds = self.bounds;
|
||||
_deallocating = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
_deallocating = YES;
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
@@ -49,6 +58,16 @@
|
||||
self.threadSafeBounds = bounds;
|
||||
}
|
||||
|
||||
- (void)setContentOffset:(CGPoint)contentOffset
|
||||
{
|
||||
if (_deallocating) {
|
||||
return;
|
||||
}
|
||||
|
||||
[super setContentOffset:contentOffset];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@interface ASTextKitComponents ()
|
||||
|
||||
Reference in New Issue
Block a user