GC BUG: Referenced object destroyed before released

Koroskin Denis 2korden at gmail.com
Sun Mar 16 07:48:01 PDT 2008


On Sun, 16 Mar 2008 17:15:36 +0300, Vladimir Panteleev  
<thecybershadow at gmail.com> wrote:

> Quoting from http://www.digitalmars.com/d/1.0/class.html#destructors :
>
>> Furthermore, the order in which the garbage collector calls destructors  
>> for unreference objects is not specified.
>
> So, it's not a bug :) You can't rely on the order of which objects will  
> be destroyed.
>

Yes:
> order in which the garbage collector calls destructors for  
> /unreferenced/ objects is not specified.

However, in this particular example Resource _is_ a referenced object,  
unlike Owner, which is not.
In any case, is this code wrong? If not, why does it cause acess violation?



More information about the Digitalmars-d mailing list