On Wednesday, 5 November 2014 at 17:45:00 UTC, luminousone wrote:
abstract class foo {
    static DList!foo foo_list;
    ~this(){ foo_list.remove(this); }

One note: when your program exits the runtime does a final GC cycle and collects those things calling destructors/finalizers, however the static data can easily be already collected/destructed at this moment, so attempting to access it from object's finalizer will crash. One should not ever access any reference types and data outside the object itself from a destructor/finalizer.

Reply via email to