Skip to content

[Runtime] Teach BridgeObjectBox::retain() not to drop the "not native" bit. #16108

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

Merged
merged 1 commit into from
Apr 23, 2018

Conversation

DougGregor
Copy link
Member

The "not native" bit in a BridgeObject is important, because it tells
us when we need to go through the Objective-C -retain method
vs. swift_retain. Losing the bit means that swift_retain() will stomp
on some memory within an Objective-C object, thinking its the inline
reference count.

Co-debugged with Arnold, who then found where this bit was getting dropped.
Fixes rdar://problem/39629937.

…" bit.

The "not native" bit in a BridgeObject is important, because it tells
us when we need to go through the Objective-C -retain method
vs. swift_retain. Losing the bit means that swift_retain() will stomp
on some memory within an Objective-C object, thinking its the inline
reference count.

Co-debugged with Arnold, who then found where this bit was getting dropped.
Fixes rdar://problem/39629937.
@DougGregor DougGregor force-pushed the runtime-bridge-object-box branch from 7113456 to d755b38 Compare April 23, 2018 21:04
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

Copy link
Contributor

@aschwaighofer aschwaighofer 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. Thank you Doug!

@gottesmm
Copy link
Contributor

This is very similar to the swift_unknownRetain bug. We really should make changes to the runtime that define away this problem. Or at least makes it much easier to catch it.

@swift-ci swift-ci merged commit aa6742c into swiftlang:master Apr 23, 2018
@DougGregor DougGregor deleted the runtime-bridge-object-box branch April 23, 2018 21:56
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.

4 participants