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

use [data copy] to be extra safe #32

Merged
merged 2 commits into from
Mar 11, 2024
Merged

use [data copy] to be extra safe #32

merged 2 commits into from
Mar 11, 2024

Conversation

woshimaliang
Copy link
Contributor

For NSData (the actual concrete type under the hood is OS_dispatch_data), i feel the copy here should be good because if the data is truly immutable, copy will just referenceCount++, and if its NSMutableData, then copy is just right.

Copy link
Collaborator

@jparise jparise left a comment

Choose a reason for hiding this comment

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

What do you think about changing the PINNSURLSessionDataTaskResult.data property to copy instead?

@property (nonatomic) NSData * _Nullable data;

@woshimaliang woshimaliang merged commit 285084c into master Mar 11, 2024
2 checks passed
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.

None yet

2 participants