home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sun4nl!utrcu1!infnews!infnews!pool
- From: pool@cs.utwente.nl (Sander Pool)
- Subject: Re: Problem with 'automatic' destructors
- Message-ID: <1992Aug19.162647@cs.utwente.nl>
- Keywords: destructor
- Sender: usenet@cs.utwente.nl
- Nntp-Posting-Host: utis116
- Organization: University of Twente, Dept. of Computer Science
- References: <1992Aug19.145847@cs.utwente.nl>
- Date: Wed, 19 Aug 1992 14:26:47 GMT
- Lines: 60
-
- In article <1992Aug19.145847@cs.utwente.nl>, pool@cs.utwente.nl (Sander Pool) writes:
- |> hello,
- |>
- |> I'm having a 'little' problem with destructors which are called
- |> automatically when 'exit()' is called. For some reason the object
- |> has turned to garbadge (e.g. the attributes have illegal values)
- |> before the destructor is called. This results in funny/disasterous
- |> situations. xdbx doesn't help much, when I trap the call to the
- |> destructor and try to examine attributes he won't even show them.
- |>
- |> The class structure looks like this (where Problem is the problem class):
- |>
- |> class Problem {
- |> public:
- |> ~Problem(); // this gets called with a bogus object
- |> };
- |>
- |> class Super {
- |> protected:
- |> Problem problem;
- |> };
- |>
- |> class Action: public xview_class, public Super;
- |>
- |>
- |> I create an automatic instance of Action like this
- |>
- |> Action action; // obvious :-)
- |>
- |> and the somewhere in an eventhandler I call 'exit(0)'.
- |>
- |>
- |> I'm at a total loss and hope someone can help me out. I
- |> use cfront 2.1 on a Sparc.
- |>
- |> thanks in advance and regards,
- |>
- |> Sander
- |>
- |> ******************************************************************
- |> Sander O. Pool Twente University,
- |> department of Computer Science
- |> SETI group / TRESE project H303
- |> __________________________________________________________________
- |> address:PO Box 217 | misc. phone +31-53-893715
- |> 7500 AE Enschede | fax +31-53-356531
- |> The Netherlands | email pool@cs.utwente.nl
- |> ******************************************************************
- |>
- |>
- |>
-
- OK, this seems a bit silly, replying to my own post, but I've got
- some additional info. I added a destructor to class Action which doesn't
- do anything but resetting it's attributes to 0. Now the destructor of
- Problem gets called properly. This solves my problem but doesn't
- explain why it occurs. Any clues?
-
- thanks,
- sander
-