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-5545] Indicate that the values behind unowned references are inaccessible when their deinitializer is running #4625

Open
swift-ci opened this issue Jul 24, 2017 · 2 comments

Comments

@swift-ci
Copy link

Previous ID SR-5545
Radar None
Original Reporter Reitzig (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Improvement
Assignee None
Priority Medium

md5: 82a189a310fe7ef941c2b112dac5231e

Issue Description:

I ran into an issue with unowned vs weak that surprised me. The problem was clearly with me: due do things happening concurrently, I tried to dereference an unowned reference whose target was currently being deinitialized.

However, the debugger didn't help me figure out what the issue was: at the crash site, it would happily show the full object that I expected behind the reference. Ergo, I could not see at all why that line of code would fail.

Proposal: once deinit starts to run on any object instance, all unowned references to it should be shown to point to nil, just like for weak references, or (better yet) indicate that the value inaccessible because it's currently being deallocated/deinitialized.

(FWIW, I'm using the debugger from an IDE, so any warning should be output in a way that IDEs can pick up.

@belkadan
Copy link

It's possible that you're trying to debug the deinitializer, though, or something it calls. Maybe just printing a warning before showing the contents would be good enough.

@swift-ci
Copy link
Author

Comment by Raphael (JIRA)

That is true if I debug the context of the deinitializer. I was, however, debugging totally different code running on another thread – and from there, you "see" nil, basically.

A warning or other indication that the shown value is not really accessible due to currently being deallocated/deinitialized would be fine, too, and arguably even more helpful since it gives better indication as to what the problem may be.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants