mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[ASTraitCollection] Remove traitCollectionContext from ASTraitCollection; add containerWindowSize
Passing around a pointer was leading to crashes as the ASVC was the sole owner of the context. There are cases where the VC would dealloc while its subnodes were laying out. This could lead to the subnodes accessing a garbage pointer.
This commit is contained in:
@@ -27,18 +27,6 @@ typedef ASTraitCollection * _Nonnull (^ASDisplayTraitsForTraitWindowSizeBlock)(C
|
||||
|
||||
@property (nonatomic, strong, readonly) DisplayNodeType node;
|
||||
|
||||
/**
|
||||
* An optional context to pass along with an ASTraitCollection.
|
||||
* This can be used to pass any internal state to all subnodes via the ASTraitCollection that is not
|
||||
* included in UITraitCollection. This could range from more fine-tuned size classes to a class of
|
||||
* constants that is based upon the new trait collection.
|
||||
*
|
||||
* Be aware that internally this context is held by a C struct which cannot retain the pointer. Therefore
|
||||
* ASVC keeps a strong reference to the context to make sure that it stays alive. If you change this value
|
||||
* it will propagate the change to the subnodes.
|
||||
*/
|
||||
@property (nonatomic, strong) id _Nullable traitCollectionContext;
|
||||
|
||||
/**
|
||||
* Set this block to customize the ASDisplayTraits returned when the VC transitions to the given traitCollection.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user