Charles Hixson wrote:
I replaced BlockFile.close with:
   void  close()
   {  if (bf !is null)  delete bf;        //    bf.close;
      bf =  null;
   }

But that didn't alter the segmentation fault. (Did you try it under D1 or D2?)

Your destructor calls close(), and close() accesses the reference bf. But accessing references is not allowed in destructors. I think "delete bf;" still counts as accessing a reference.

The reason is, that the garbage collector calls the destructor, when an object becomes unreachable. The order the destructors are called is undefined. References to other objects may no longer be valid, because these objects were already destroyed.

Reply via email to