On 09/04/13 13:42, Joseph Rushton Wakeling wrote: > On 03/09/13 12:00, Sönke Ludwig wrote: >> Just a warning: This can still easily crash due to D's struct move semantics. >> Structs are moved around sometimes without any postblit constructor or >> destructor being called, so fixing self-references like this won't work in >> general. > > Is the patch to Phobos risky, then? I'll switch to an alternative design if > so.
No, like i said, that's not how I'd do it (I would make `this` explicit and avoid all those issues), but that last patch /will/ work. The problem is with *pointers* inside an object that point to that same object. 'Pointers' includes delegates (those contain a context pointer). You're not storing any pointers, so it's ok. It was my first quick "fix", which attempted to update the context pointer in the postblit, that was wrong. artur