mirror of
https://github.com/Codeux-Software/Textual.git
synced 2026-06-16 13:24:32 +00:00
Dereference TVCAlert completion block when alert dismisses
TDCAlert holds strong reference to TVCAlert using its completion block. That's how TDCAlert is able to present an alert without the caller having to retain it. We should dereference that completion block in TVCAlert when we are finished to break that reference cycle.
This commit is contained in:
@@ -62,7 +62,7 @@ typedef NS_ENUM(NSUInteger, TVCAlertType) {
|
||||
@property (nonatomic, assign) BOOL alertVisible;
|
||||
@property (nonatomic, assign) BOOL layoutPerformed;
|
||||
@property (nonatomic, assign) TVCAlertType alertType;
|
||||
@property (nonatomic, copy) TVCAlertCompletionBlock completionBlock;
|
||||
@property (nonatomic, copy, nullable) TVCAlertCompletionBlock completionBlock;
|
||||
@property (nonatomic, copy, nullable) TVCAlertButtonClickedBlock firstButtonAction;
|
||||
@property (nonatomic, copy, nullable) TVCAlertButtonClickedBlock secondButtonAction;
|
||||
@property (nonatomic, copy, nullable) TVCAlertButtonClickedBlock thirdButtonAction;
|
||||
@@ -473,6 +473,10 @@ typedef NS_ENUM(NSUInteger, TVCAlertType) {
|
||||
LogToConsoleDebug("[%@] Alert dismissed", self);
|
||||
|
||||
self.alertVisible = NO;
|
||||
|
||||
// Dereference completion block when finished because the
|
||||
// completion block may be the only reference to self.
|
||||
self.completionBlock = nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
Reference in New Issue
Block a user