Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Fix retain cycles #943

Merged
merged 5 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MatrixKit/Controllers/MXKAuthenticationViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
/**
The delegate for the view controller.
*/
@property (nonatomic) id<MXKAuthenticationViewControllerDelegate> delegate;
@property (nonatomic, weak) id<MXKAuthenticationViewControllerDelegate> delegate;

/**
current ongoing MXHTTPOperation. Nil if none.
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Controllers/MXKContactDetailsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/**
The delegate for the view controller.
*/
@property (nonatomic) id<MXKContactDetailsViewControllerDelegate> delegate;
@property (nonatomic, weak) id<MXKContactDetailsViewControllerDelegate> delegate;

#pragma mark - Class methods

Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Controllers/MXKContactListViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
/**
The delegate for the view controller.
*/
@property (nonatomic) id<MXKContactListViewControllerDelegate> delegate;
@property (nonatomic, weak) id<MXKContactListViewControllerDelegate> delegate;

/**
Enable the search option by adding a navigation item in the navigation bar (YES by default).
Expand Down
4 changes: 2 additions & 2 deletions MatrixKit/Controllers/MXKGroupListViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -65,7 +65,7 @@
/**
The delegate for the view controller.
*/
@property (nonatomic) id<MXKGroupListViewControllerDelegate> delegate;
@property (nonatomic, weak) id<MXKGroupListViewControllerDelegate> delegate;

/**
Enable the search option by adding a navigation item in the navigation bar (YES by default).
Expand Down
8 changes: 7 additions & 1 deletion MatrixKit/Controllers/MXKGroupListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -513,8 +514,13 @@ - (void)onSyncNotification
{
latestServerSync = [NSDate date];

MXWeakify(self);

// Refresh all groups summary
[self.dataSource refreshGroupsSummary:^{

MXStrongifyAndReturnIfNil(self);

[self removeReconnectingView];
}];
}
Expand Down
3 changes: 2 additions & 1 deletion MatrixKit/Controllers/MXKRecentListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ typedef enum : NSUInteger
/**
The delegate for the view controller.
*/
@property (nonatomic) id<MXKRoomMemberDetailsViewControllerDelegate> delegate;
@property (nonatomic, weak) id<MXKRoomMemberDetailsViewControllerDelegate> delegate;

#pragma mark - Class methods

Expand Down
4 changes: 4 additions & 0 deletions MatrixKit/Controllers/MXKRoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Models/Group/MXKGroupCellDataStoring.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
@protocol MXKGroupCellDataStoring <NSObject>

@property (nonatomic, readonly) MXKSessionGroupsDataSource *groupsDataSource;
@property (nonatomic, weak, readonly) MXKSessionGroupsDataSource *groupsDataSource;

@property (nonatomic, readonly) MXGroup *group;

Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Views/Authentication/MXKAuthInputsView.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ typedef enum {
/**
The view delegate.
*/
@property (nonatomic) id <MXKAuthInputsViewDelegate> delegate;
@property (nonatomic, weak) id <MXKAuthInputsViewDelegate> delegate;

/**
The current authentication type (`MXKAuthenticationTypeLogin` by default).
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Views/DeviceView/MXKDeviceView.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
/**
The delegate.
*/
@property (nonatomic) id<MXKDeviceViewDelegate> delegate;
@property (nonatomic, weak) id<MXKDeviceViewDelegate> delegate;

/**
The default text color in the text view. [UIColor blackColor] by default.
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
@property (weak, nonatomic) IBOutlet UIButton *blockButton;
@property (weak, nonatomic) IBOutlet UIButton *confirmVerifyButton;

@property (nonatomic) id<MXKEncryptionInfoViewDelegate> delegate;
@property (nonatomic, weak) id<MXKEncryptionInfoViewDelegate> delegate;

/**
Initialise an `MXKEncryptionInfoView` instance based on an encrypted event
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Views/MXKRoomCreationView.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/**
The delegate.
*/
@property (nonatomic) id<MXKRoomCreationViewDelegate> delegate;
@property (nonatomic, weak) id<MXKRoomCreationViewDelegate> delegate;

/**
Hide room name field (NO by default).
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5058.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix retain cycles that prevents deallocation in several classes.