Need help with debugging Segfault

d coder dlang.coder at gmail.com
Mon Dec 3 02:25:42 PST 2012


> But it's not a bug. Like Ali said:
>
> The destruction order of GC-maintained resources is not deterministic as
> e.g. in C++. It is quite possible that the member of an object is destroyed
> before the object itself.


Oops. I get it now.

What should be done to avoid this situation? I think I need to add a
destructor for the parent object class that would make sure that such child
objects (that need the parent to be alive during GC process) are destroyed
before the GC process kicks in. Would that be sufficient or would it again
group such GC processes and still keep the sequence indeterminable? In that
case, I will need to introduce a finalize() function which needs to be
called explicitly.

Thanks and Regards
- Puneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121203/a0e9a545/attachment.html>


More information about the Digitalmars-d mailing list