if (X !is null && X.Y !is null) access crash

Amex Amex at gmail.com
Fri Jun 7 16:01:25 UTC 2019


On Friday, 7 June 2019 at 14:07:34 UTC, KnightMare wrote:
> On Friday, 7 June 2019 at 09:26:52 UTC, Amex wrote:
>> if (X !is null && X.Y !is null) access crash
>> is crashing.
>
> imo this code is valid. u can write shorter
> if (X && X.Y)
> probably crashed in some another place (X is not objRef but 
> something else.. some code later at same line.. dunno)

The debugger is telling me it is at that line.

X is an object.

In the debugger X is shown with an address yet when expanded all 
the members are invalid. It happens rarely so it makes it even 
harder to diagnose. Only thing I can think of is that it has to 
do with the GC. I suppose I could turn off the GC for shutting 
down and that might prevent such as crash.



More information about the Digitalmars-d-learn mailing list