| delorie.com/archives/browse.cgi | search |
| From: | Mark Phillips <umphill5 AT cs DOT umanitoba DOT ca> |
| 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: | <Pine.GSO.3.96.990528132952.18715A-100000@gold.cs.umanitoba.ca> |
| NNTP-Posting-Host: | gold.cs.umanitoba.ca |
| Mime-Version: | 1.0 |
| 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |