Skip to content

[SR-5545] Indicate that the values behind unowned references are inaccessible when their deinitializer is running #4625

Open
@swift-ci

Description

@swift-ci
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions