-
Notifications
You must be signed in to change notification settings - Fork 235
Fix bug in CFArray::to_untyped that made the retain count wrong #139
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
Conversation
Let's increase the patch version number and publish a new version as part of this PR. Can we add a test, too? |
Sure. I'll fix that! Just a moment. |
I realize I only tested |
6d88b3d
to
c33598d
Compare
@bors-servo: r+ |
📌 Commit c33598d has been approved by |
Fix bug in CFArray::to_untyped that made the retain count wrong The following code segfaults on the `0.4.5` release: ```rust CFArray::<CFBoolean>::from_CFTypes(&[]).to_untyped().to_untyped().to_untyped() ``` Because `to_untyped` don't increment the retain count, but when the typed array it's created from goes out of scope that one will decrement it. And since we need to wrap under the get rule (call `CFRetain`) anyway I did not see any reason to have it as a consuming `to_` method. It's more flexible as a borrowing `as_` method. Since you probably don't want to cause API breakage I kept the old version but fixed the bug and added a deprecation notice on it. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/139) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
The following code segfaults on the
0.4.5
release:Because
to_untyped
don't increment the retain count, but when the typed array it's created from goes out of scope that one will decrement it.And since we need to wrap under the get rule (call
CFRetain
) anyway I did not see any reason to have it as a consumingto_
method. It's more flexible as a borrowingas_
method.Since you probably don't want to cause API breakage I kept the old version but fixed the bug and added a deprecation notice on it.
This change is