Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings in Contacts module #4681

Merged
merged 7 commits into from
Aug 10, 2021
Merged

Conversation

pixlwave
Copy link
Member

@pixlwave pixlwave commented Aug 9, 2021

Part of #4677.

@@ -196,21 +196,24 @@ - (void)searchWithPattern:(NSString *)searchText forceReset:(BOOL)forceRefresh h
[hsUserDirectoryOperation cancel];
hsUserDirectoryOperation = nil;
}

MXWeakify(self);
Copy link
Member Author

@pixlwave pixlwave Aug 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is weakifying and strongifying the right thing to do in this case as the request could have a longer lifetime than the data source which is holding a strong reference to it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay. MXStrongifyAndReturnIfNil will return if the dataSource has been released in the meantime.

{
return;
}
MXStrongifyAndReturnIfNil(self);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me a Weakify/Strongify would have the same effect here, but flagging in case it doesn't.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stefanceriu stefanceriu self-requested a review August 10, 2021 09:49
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@@ -196,21 +196,24 @@ - (void)searchWithPattern:(NSString *)searchText forceReset:(BOOL)forceRefresh h
[hsUserDirectoryOperation cancel];
hsUserDirectoryOperation = nil;
}

MXWeakify(self);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay. MXStrongifyAndReturnIfNil will return if the dataSource has been released in the meantime.

{
return;
}
MXStrongifyAndReturnIfNil(self);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pixlwave pixlwave merged commit 4b3e6e3 into develop Aug 10, 2021
@pixlwave pixlwave deleted the doug/4677_fix_contacts_warnings branch August 10, 2021 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants