GC BUG: Referenced object destroyed before released

Bill Baxter dnewsgroup at billbaxter.com
Sun Mar 16 17:45:30 PDT 2008


Graham St Jack wrote:

> I guess the work-around (and maybe permanent) is to not reference any 
> garbage-collected objects in your destructors. 

Err, that's more or less what the documentation says.

"""
When the garbage collector calls a destructor for an object of a class 
that has members that are references to garbage collected objects, those 
references are no longer valid. This means that destructors cannot 
reference sub objects.
"""
-- http://www.digitalmars.com/d/1.0/class.html#destructors

Maybe it would be more precise to say "This means destructors cannot 
reference garbage collected objects".

--bb



More information about the Digitalmars-d mailing list