Skip to content

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

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

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.

(cherry picked from commit d755b38)
@DougGregor
Copy link
Member Author

@swift-ci please test and merge

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test and merge

@slavapestov
Copy link
Contributor

Nice catch!

@swift-ci swift-ci merged commit f77dab5 into swiftlang:swift-4.2-branch Apr 24, 2018
@DougGregor DougGregor deleted the runtime-bridge-object-box-4.2 branch April 24, 2018 00:26
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.

3 participants