Preventing nested struct destructor accessing stack frame

Nick Treleaven nick at geany.org
Fri Dec 16 12:17:40 UTC 2022


This code segfaults when the GC calls the dtor after the unittest 
succeeds:

```d
unittest
{
     int i;
     struct S
     {
         ~this() { i++; }
     }
     (*new S).destroy;
}
```

It seems destroy clears the context pointer. Is there a way to 
test if the context pointer is null in the dtor, to prevent the 
increment?


More information about the Digitalmars-d-learn mailing list