From: Mark Phillips Newsgroups: comp.os.msdos.djgpp Subject: destructor problem Date: Fri, 28 May 1999 13:39:17 -0500 Organization: The University of Manitoba Lines: 42 Message-ID: NNTP-Posting-Host: gold.cs.umanitoba.ca Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: canopus.cc.umanitoba.ca 927916766 6300 130.179.24.1 (28 May 1999 18:39:26 GMT) X-Complaints-To: Postmaster AT cc DOT umanitoba DOT ca NNTP-Posting-Date: 28 May 1999 18:39:26 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com hi. i have a destructor that just calls a close member function: foo::~foo() { close(); } close() causes a gpf when the destructor calls it. on the other hand if i comment out the call to close, and explicitly call it when an instance goes out of scope like so: int main() { foo instance; ... instance.close(); return 0; } it executes normally. that seems pretty weird to me. anyone have any ideas? i don't see why close() would cause a gpf in the first place though, it seems pretty safely coded: void foo::close() { if(data!=NULL) { unlock(); delete [] data; } data=NULL; curr=NULL; size=0; } by the way, i traced the gpf back to the 'delete [] data' line. even when i explicitly call the close() function multiple times in a row right before going out of scope it works fine. TIA mark