http://d.puremagic.com/issues/show_bug.cgi?id=6014


d...@dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d...@dawgfoto.de


--- Comment #17 from d...@dawgfoto.de 2011-09-13 17:13:13 PDT ---
It could as well be a double finalization.
The vtable pointer is cleared when calling rt_finalize on a class.

There is also a deterministic bug happening due to an oversight in the
finalization design. Finalization is done in memory order and does not take
hierarchies into account.

---
class A
{
    ~this() {}
    void cleanup() {}
}

class B
{
    this(A a) { this.a = a; }
    ~this() { a.cleanup(); }
    A a;
}

void main() {
    auto a = new A();
    auto b = new B(a);
    // allocating a at a lower address than b causes it to be finalized earlier
    assert(cast(void*)b.a < cast(void*)b);
}
---

When b.a is finalized before b it's vtable is set to null, hence
the segfault at accessing the classinfo.

It seems like we need to somehow sort the to be finalized memory while
scanning.
Any cheap ideas to do that are welcome.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to