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 a crash issue when meeting up NSMapTable with NSPointerFunctionsOpaqueMemory. #79

Merged
merged 2 commits into from Jul 15, 2019

Conversation

xushuangqing
Copy link

@xushuangqing xushuangqing commented Jul 14, 2019

Fix a crash issue when meeting up NSMapTable with NSPointerFunctionsOpaqueMemory.

#60 (comment)

For NSMapTable with NSPointerFunctionsOpaqueMemory, FBRetainCycleDetector treats inner object as strong reference, as pointerFunctions.usesWeakReadAndWriteBarriers returns NO.

acquireFunction is called for copy-in operations. If acquireFunction is NULL, it means nothing will be done when copied-in, so the memory will not be retained.
It cannot be guarantee that acquireFunction is always NULL when the memory option is NSPointerFunctionsOpaqueMemory. But it is better than we do nothing.

The crash can be reproduced in the added test case.

@xushuangqing xushuangqing changed the title Fix opaque container Fix a crash issue when meeting up with NSMapTable with NSPointerFunctionsOpaqueMemory. Jul 14, 2019
@xushuangqing xushuangqing changed the title Fix a crash issue when meeting up with NSMapTable with NSPointerFunctionsOpaqueMemory. Fix a crash issue when meeting up NSMapTable with NSPointerFunctionsOpaqueMemory. Jul 14, 2019
@xushuangqing xushuangqing marked this pull request as ready for review July 14, 2019 09:54
@megCanicalKb
Copy link
Contributor

Awesome change, thanks for this :)

@megCanicalKb megCanicalKb merged commit 3b99793 into facebook:master Jul 15, 2019
@LuckyCat7848
Copy link

@Megra It's a good change, Please type a new release package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants