On Thursday, 27 February 2014 at 09:57:51 UTC, Tobias Pankrath
wrote:
On Thursday, 27 February 2014 at 09:55:14 UTC, Tobias Pankrath
wrote:
On Thursday, 27 February 2014 at 09:49:08 UTC, Szymon Gatner
wrote:
My crashes (still have them and can't track all as debugging
D sucks) are caused by the fact that d-tor of parent object
can be called before child d-tors. Adding destroy() calls in
parent d-tors helped with some of crashes but I really hate
this solution as I was virtually NEVER using 'delete' in C++.
Spec says:
--
The garbage collector is not guaranteed to run the destructor
for all unreferenced objects. Furthermore, the order in which
the garbage collector calls destructors for unreference objects
is not specified. This means that when the garbage collector
calls a destructor for an object of a class that has members
that are references to garbage collected objects, those
references may no longer be valid. >> This means that
destructors cannot reference sub objects. <<
--
Parent-child in the sense of object graph. I did read the spec
when I started to notice crashes. I must say that it really
terrified me to my very bones. I always though that higher-level
memory management environments would give more and not less
guarantees.
Anyway, I really need to learn how to design the code for CG and
undefined d-tor calls. Any pointers would be welcome.