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

一个crash问题 #37

Closed
SatanWoo opened this issue Oct 8, 2016 · 2 comments
Closed

一个crash问题 #37

SatanWoo opened this issue Oct 8, 2016 · 2 comments

Comments

@SatanWoo
Copy link

SatanWoo commented Oct 8, 2016

Zepo@66b071f

您好,不知道在哪里请教问题比较合适。所以还借此请教下,这个commit的修改里,为什么采用对象比较就会crash。而采用对象的地址比较就没问题呢?

@Zepo
Copy link
Collaborator

Zepo commented Oct 12, 2016

objc_setAssociatedObject 的时候用的是 OBJC_ASSOCIATION_ASSIGN,是非持有的,对象可能会被释放。如果对象被释放了,那么 objc_getAssociatedObject 拿出来的时候会默认给对象发 retain 消息(ARC),导致 crash

@SatanWoo
Copy link
Author

明白!谢谢!

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

No branches or pull requests

2 participants