On 12/21/2016 07:01 AM, Eugene Wissner wrote:

> Isn't an optimization that changes the behavior bad? I had a crash in
> the code where the destructor did something meaningfull, freed the
> memory (the same pointer) twice.

Sounds like you ended up with two objects that owned the same resource. You can either '@disable this(this)' so that copies of this type are not allowed or you can handle the resource in a different way: Make a copy of the resource in this(this) so the two copies have their own separate resources, leave the resource to the GC, use reference counting, etc.

Ali

Reply via email to