Tom Kazimiers <2voo...@gmx.de> wrote:

Hi,

a file reading class of mine can be constructed with a filename as
parameter. It instantiates a new std.stream.File (without the passed
file name and closes it when opened within the destructor. The last part
is where things are getting unclear for me. On the "file.isOpen()" call
in the destructor a segmentation fault occurs. What is the problem with
that?

Likely, it is this[1]:

"[T]he 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."

[1]: http://digitalmars.com/d/2.0/class.html#destructors

--
Simen

Reply via email to