Skip to content

[SR-6398] Ensure CFSTR() is CFRetained because it is not permanent on Linux. #1351

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
Dec 3, 2017

Conversation

parkera
Copy link
Contributor

@parkera parkera commented Dec 1, 2017

No description provided.

@parkera
Copy link
Contributor Author

parkera commented Dec 1, 2017

@swift-ci please test

@parkera parkera merged commit 6dea2bc into swiftlang:master Dec 3, 2017
@jrose-apple
Copy link
Contributor

Is there a reason not to put that into the CFSTR macro itself?

@parkera
Copy link
Contributor Author

parkera commented Dec 11, 2017

CFSTR has no ability to determine how many times the result will be released.

@parkera
Copy link
Contributor Author

parkera commented Dec 11, 2017

The real fix for this is the ability to mark Swift objects as immortal and have swift_release short-circuit.

zayass pushed a commit to readdle/swift-corelibs-foundation that referenced this pull request Apr 19, 2019
zayass pushed a commit to readdle/swift-android-toolchain that referenced this pull request Apr 19, 2019
Fix URLComponents crash swiftlang/swift-corelibs-foundation#1351
Avoid Bundle.main on android
dhoepfl added a commit to dhoepfl/swift-corelibs-foundation that referenced this pull request Nov 3, 2022
…deallocated" in Linux foundation

The reported error was an CFSTR("") which is later released. While this should
not be a problem, the Linux implementation of CFSTR does not ignore dealloc
on constant strings. Fixed this by calling CFRetain on the constant string.

Strictly speaking this is only a workaround. Issue swiftlang#1351 has some hints how
this could be fixed but the workaround is used a over the code so I think it
is okay to use it here, too.

I found the same problem in CFDateIntervalFormatter.c where it appeared in a
error handling code path that should never be called. Fixed anyways.
parkera pushed a commit that referenced this pull request Nov 2, 2023
…ed" in Linux foundation (#4653)

The reported error was an CFSTR("") which is later released. While this should
not be a problem, the Linux implementation of CFSTR does not ignore dealloc
on constant strings. Fixed this by calling CFRetain on the constant string.

Strictly speaking this is only a workaround. Issue #1351 has some hints how
this could be fixed but the workaround is used a over the code so I think it
is okay to use it here, too.

I found the same problem in CFDateIntervalFormatter.c where it appeared in a
error handling code path that should never be called. Fixed anyways.
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.

2 participants