if (X !is null && X.Y !is null) access crash
Steven Schveighoffer
schveiguy at gmail.com
Sat Jun 8 20:44:13 UTC 2019
On 6/8/19 2:28 AM, Amex wrote:
> On Friday, 7 June 2019 at 16:09:47 UTC, Adam D. Ruppe wrote:
>>> It happens when I close down my app.
>>
>> is this inside a destructor?
>
> No, it's in an external thread(it is in a callback). All I can think of
> is that something is happening in between the two checks since there is
> no way it could happen otherwise.
>
>
>
Possible the GC cleaned up the object already. When this happens, you
get this kind of behavior (the GC intentionally sets the vtable to null
to prevent invalid access).
Try GC.addRef on the X reference, and see if it helps.
-Steve
More information about the Digitalmars-d-learn
mailing list