Skip to content
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

[SR-13551] deinit and autorelease will crash in AutoreleasePoolPage::releaseUntil #55988

Open
swift-ci opened this issue Sep 15, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13551
Radar rdar://problem/68926773
Original Reporter 酷酷的哀殿 (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: d32d186812b4ef33f6a691df912a684d

Issue Description:

Crash Info:

The follow code will crash in x86_64 with Thread 1: EXC_BAD_ACCESS (code=1, address=0x20)

Crash Reason:

Manager will be release after deinit.

Code:

//代码占位符
import Foundation
 
class Manager: NSObject {
    deinit {
        let _ = String(format:"%p", self)
    }
}
 
class MY {
    func test() {
        let _ = Manager()
    }
}
 
autoreleasepool {
    MY().test()
}
 
print("Hello, World!")

Solution:

//代码占位符
class Manager: NSObject {
    deinit {
        autoreleasepool {
            let _ = String(format:"%p", self)
        }
    }
}
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants