-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Encountering "Constant strings cannot be deallocated" in Linux foundation #4642
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
Comments
FYI, reported it back in 2021 swiftlang/swift#56730 |
dhoepfl
added a commit
to dhoepfl/swift-corelibs-foundation
that referenced
this issue
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 issue
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.
On this day, one year ago, I submitted the pull request. This should resolves a crashing bug initially reported 2177 days (nearly 6 years) ago. 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Using
Bundle.module.url(forResource:, withExtension:,subdirectory:)
results in error message "Foundation/NSCFString.swift:119: Fatal error: Constant strings cannot be deallocated"Steps To Reproduce
Steps to reproduce the behavior:
mkdir swiftbug; cd swiftbug; swift package init
mkdir Tests/swiftbugTests/Resources; touch Tests/swiftbugTests/Resources/dummy.png
swift test
Expected behavior
Tests should finish without an error.
Actual result
Environment (please fill out the following information)
Additional context
Might be related to/regression of #3785
The text was updated successfully, but these errors were encountered: