Heisenbug involving Destructors & GC - Help Needed

rsw0x via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 26 20:16:33 PDT 2015


On Saturday, 27 June 2015 at 02:53:42 UTC, Etienne Cimon wrote:
> On 2015-06-26 14:27, Maxime Chevalier-Boisvert wrote:
>
> This might come as a surprise to you as much as it did to me at 
> the time, but when you have GCRoot* root; where GCRoot is a 
> struct, if you destroy(root), you're setting your local pointer 
> to null. You're not actually calling the destructor on the 
> struct.
>
> Also, I would avoid throwing of any type in a destructor.
>
> https://github.com/higgsjs/Higgs/blob/0b48477120c4acce46a01b05a1d4b035aa432550/source/jit/codeblock.d#L157

calling destroy on a pointer should either be fixed or be an 
error, that should not be allowed to happen.


More information about the Digitalmars-d mailing list