You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
Additional Detail from JIRA
md5: 82a189a310fe7ef941c2b112dac5231e
Issue Description:
I ran into an issue with
unowned
vsweak
that surprised me. The problem was clearly with me: due do things happening concurrently, I tried to dereference anunowned
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, allunowned
references to it should be shown to point tonil
, just like forweak
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.
The text was updated successfully, but these errors were encountered: