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.

Is there right now any way to arrange things?

Reply via email to