X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Newsgroups: comp.os.msdos.djgpp Subject: Destructor being called twice? From: boohiss Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera M2/7.54 (Win32, build 3869) Lines: 20 Date: Mon, 01 Nov 2004 23:56:32 GMT NNTP-Posting-Host: 24.95.40.189 X-Complaints-To: abuse AT rr DOT com X-Trace: fe1.columbus.rr.com 1099353392 24.95.40.189 (Mon, 01 Nov 2004 18:56:32 EST) NNTP-Posting-Date: Mon, 01 Nov 2004 18:56:32 EST Organization: Road Runner High Speed Online http://www.rr.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I have written a class with my own constructor and destructor. I declare an object of this class globally. The class is constructed just fine, but when the program exits, the destructor is being called twice for some reason unknown to me. This is causing a seg fault, since I am trying to write to a file from a string array in the destructor, and the 2nd time the destructor is called, it writes anywhere from 80-100k of garbage to my file. I am *not* calling this destructor anywhere in the program, it should only be called once (implicitly) upon program end. Any idea what I'm doing wrong here? -Matt -- http://www.mgroves.com