diff --git a/MatrixKit/Controllers/MXKAuthenticationViewController.h b/MatrixKit/Controllers/MXKAuthenticationViewController.h index 49a0edd93..ffb64afbe 100644 --- a/MatrixKit/Controllers/MXKAuthenticationViewController.h +++ b/MatrixKit/Controllers/MXKAuthenticationViewController.h @@ -146,7 +146,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** current ongoing MXHTTPOperation. Nil if none. diff --git a/MatrixKit/Controllers/MXKContactDetailsViewController.h b/MatrixKit/Controllers/MXKContactDetailsViewController.h index 3d2e13222..417f586a7 100644 --- a/MatrixKit/Controllers/MXKContactDetailsViewController.h +++ b/MatrixKit/Controllers/MXKContactDetailsViewController.h @@ -56,7 +56,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; #pragma mark - Class methods diff --git a/MatrixKit/Controllers/MXKContactListViewController.h b/MatrixKit/Controllers/MXKContactListViewController.h index 47de9e5e9..e516aa15d 100644 --- a/MatrixKit/Controllers/MXKContactListViewController.h +++ b/MatrixKit/Controllers/MXKContactListViewController.h @@ -62,7 +62,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Enable the search option by adding a navigation item in the navigation bar (YES by default). diff --git a/MatrixKit/Controllers/MXKGroupListViewController.h b/MatrixKit/Controllers/MXKGroupListViewController.h index 14155eab1..020f78549 100644 --- a/MatrixKit/Controllers/MXKGroupListViewController.h +++ b/MatrixKit/Controllers/MXKGroupListViewController.h @@ -48,7 +48,7 @@ /** The fake top view displayed in case of vertical bounce. */ - UIView *topview; + __weak UIView *topview; } @property (weak, nonatomic) IBOutlet UISearchBar *groupsSearchBar; @@ -65,7 +65,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Enable the search option by adding a navigation item in the navigation bar (YES by default). diff --git a/MatrixKit/Controllers/MXKGroupListViewController.m b/MatrixKit/Controllers/MXKGroupListViewController.m index 1d1e533d1..e9950fa3f 100644 --- a/MatrixKit/Controllers/MXKGroupListViewController.m +++ b/MatrixKit/Controllers/MXKGroupListViewController.m @@ -145,10 +145,11 @@ - (void)viewDidLoad // Add a top view which will be displayed in case of vertical bounce. CGFloat height = self.groupsTableView.frame.size.height; - topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.groupsTableView.frame.size.width,height)]; + UIView *topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.groupsTableView.frame.size.width,height)]; topview.autoresizingMask = UIViewAutoresizingFlexibleWidth; topview.backgroundColor = [UIColor groupTableViewBackgroundColor]; [self.groupsTableView addSubview:topview]; + self->topview = topview; } - (void)viewWillAppear:(BOOL)animated @@ -513,8 +514,13 @@ - (void)onSyncNotification { latestServerSync = [NSDate date]; + MXWeakify(self); + // Refresh all groups summary [self.dataSource refreshGroupsSummary:^{ + + MXStrongifyAndReturnIfNil(self); + [self removeReconnectingView]; }]; } diff --git a/MatrixKit/Controllers/MXKRecentListViewController.m b/MatrixKit/Controllers/MXKRecentListViewController.m index 478e2315f..2f02f7e85 100644 --- a/MatrixKit/Controllers/MXKRecentListViewController.m +++ b/MatrixKit/Controllers/MXKRecentListViewController.m @@ -146,10 +146,11 @@ - (void)viewDidLoad // Add a top view which will be displayed in case of vertical bounce. CGFloat height = self.recentsTableView.frame.size.height; - topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.recentsTableView.frame.size.width,height)]; + UIView *topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.recentsTableView.frame.size.width,height)]; topview.autoresizingMask = UIViewAutoresizingFlexibleWidth; topview.backgroundColor = [UIColor groupTableViewBackgroundColor]; [self.recentsTableView addSubview:topview]; + self->topview = topview; } - (void)viewWillAppear:(BOOL)animated diff --git a/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h b/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h index 9d74a2ce0..6724f6998 100644 --- a/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h +++ b/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h @@ -142,7 +142,7 @@ typedef enum : NSUInteger /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; #pragma mark - Class methods diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 525c380ab..f1439063c 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -2109,6 +2109,8 @@ - (void)showEventDetails:(MXEvent *)event // Remove potential existing subviews [self dismissTemporarySubViews]; + MXKEventDetailsView *eventDetailsView; + if (customEventDetailsViewClass) { eventDetailsView = [[customEventDetailsViewClass alloc] initWithEvent:event andMatrixSession:roomDataSource.mxSession]; @@ -2126,6 +2128,8 @@ - (void)showEventDetails:(MXEvent *)event // Add the view and define edge constraints [self.view addSubview:eventDetailsView]; + self->eventDetailsView = eventDetailsView; + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:eventDetailsView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual diff --git a/MatrixKit/Models/Group/MXKGroupCellDataStoring.h b/MatrixKit/Models/Group/MXKGroupCellDataStoring.h index f6a07b3f6..9ca2bd57b 100644 --- a/MatrixKit/Models/Group/MXKGroupCellDataStoring.h +++ b/MatrixKit/Models/Group/MXKGroupCellDataStoring.h @@ -26,7 +26,7 @@ */ @protocol MXKGroupCellDataStoring -@property (nonatomic, readonly) MXKSessionGroupsDataSource *groupsDataSource; +@property (nonatomic, weak, readonly) MXKSessionGroupsDataSource *groupsDataSource; @property (nonatomic, readonly) MXGroup *group; diff --git a/MatrixKit/Views/Authentication/MXKAuthInputsView.h b/MatrixKit/Views/Authentication/MXKAuthInputsView.h index 8131d4c0a..c71b022ae 100644 --- a/MatrixKit/Views/Authentication/MXKAuthInputsView.h +++ b/MatrixKit/Views/Authentication/MXKAuthInputsView.h @@ -122,7 +122,7 @@ typedef enum { /** The view delegate. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** The current authentication type (`MXKAuthenticationTypeLogin` by default). diff --git a/MatrixKit/Views/DeviceView/MXKDeviceView.h b/MatrixKit/Views/DeviceView/MXKDeviceView.h index a729b1470..9e69cc1a7 100644 --- a/MatrixKit/Views/DeviceView/MXKDeviceView.h +++ b/MatrixKit/Views/DeviceView/MXKDeviceView.h @@ -69,7 +69,7 @@ /** The delegate. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** The default text color in the text view. [UIColor blackColor] by default. diff --git a/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h b/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h index e55a7fdbe..80afc81e1 100644 --- a/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h +++ b/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h @@ -48,7 +48,7 @@ @property (weak, nonatomic) IBOutlet UIButton *blockButton; @property (weak, nonatomic) IBOutlet UIButton *confirmVerifyButton; -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Initialise an `MXKEncryptionInfoView` instance based on an encrypted event diff --git a/MatrixKit/Views/MXKRoomCreationView.h b/MatrixKit/Views/MXKRoomCreationView.h index 46d296194..f269dbe87 100644 --- a/MatrixKit/Views/MXKRoomCreationView.h +++ b/MatrixKit/Views/MXKRoomCreationView.h @@ -68,7 +68,7 @@ /** The delegate. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Hide room name field (NO by default). diff --git a/changelog.d/5058.bugfix b/changelog.d/5058.bugfix new file mode 100644 index 000000000..1e8112a36 --- /dev/null +++ b/changelog.d/5058.bugfix @@ -0,0 +1 @@ +Fix retain cycles that prevents deallocation in several classes. \ No newline at end of file