Is there right now any way to arrange things?
In fact there is no order of destruction. And this is one of the
most annoying D problems I recently had to deal with. Look at
this example: http://dpaste.dzfl.pl/f3f860b0. This time, it
segfaulted. Next time it may (in theory) not, because the dtor of
a is called before the one of b. A holds a reference to a B. In
the destructor of A I expect b either to be null or a valid
instance of B (which has not been destroyed yet). You get a kind
of undefined behavior instead. This is IMO a huge drawback
towards reference counting with strong/weak references.
- Order of destruction when garbage collection kicks in Henning Pohl
- Re: Order of destruction when garbage collection... Andrej Mitrovic
- Re: Order of destruction when garbage collection... Steven Schveighoffer
- Re: Order of destruction when garbage collec... Henning Pohl
- Re: Order of destruction when garbage co... Regan Heath
- Re: Order of destruction when garbag... Regan Heath
- Re: Order of destruction when garbage co... Steven Schveighoffer
- Re: Order of destruction when garbage collection... Regan Heath
