[Issue 4621] Destructors are inherently un- at safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 5 14:13:34 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=4621



--- Comment #19 from Michel Fortin <michel.fortin at michelf.com> 2013-08-05 17:13:32 EDT ---
(In reply to comment #18)
> This is invalid report since @safe has nothing to do with accessing
> pointers/references which turned out to be nulls.

Maxim, you're the first to mention null here. I'm not sure I get your point.

This issue is about accessing destructed/deallocated memory from the destructor
while GC is finalizing an object (or a struct on the GC heap). This can happen
if you have a circular reference for instance, or anytime multiple objects that
references themselves are finalized in the same pass.

The most evil thing you could do is to leak a reference to the a finalized
object to the outer world, and then you have a pointer to deallocated memory
lying around somewhere. There's no way to catch any of this (currently), hence
why destructors are unsafe (when called from the GC).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list