Re: problem with destructor

From: bArT (bart212_at_poczta.onet.pl)
Date: 07/29/04


Date: Thu, 29 Jul 2004 19:45:51 +0200


When I deleted all methods except constructor and destructor I still have
the same error. So other methods can't cause a problem but only this
destructor or constructor.

I can't add private assigment operator, because I have such error: "function
'class CSmtp &__thiscall CSmtp::operator =(const class CSmtp &)' already has
a body".
What is Your advice?

bart

>
> Well the first thing to note is that you because it crashes in the
> destructor does not mean that the problem is with the destructor (or
> constructor). I'd like to know how you've established that the other
> methods don't have a bearing because that is the first place I would be
> looking.
>
> The only way to be sure that the problem is not with the other methods
> would be to remove them entirely and still find that the program crashed.
> Have you tried that?
>
> But the first thing to do however it to take Karl's advice and add a
> private copy constructor and a private assignment operator. If doing that
> causes a compile or link error then you've found your problem. Its very
> quick to do and to be honest should have been done already. (I'm assuming
> here that the copy constructor and assignment operator aren't two of the
> methods that you left out in your post.)
>
> If that doesn't work then I think you are reduced to cutting out whole
> sections of code until you can isolate the section that is causing the
> problem. Remember that it could be anywhere, just because the code crashes
> in the destructor of one class, does not mean that is where the problem
is.
>
> Unfortunately there is nothing fatally wrong with the code you've posted
> (that I can see). So you are going to have to hunt around or post some
> more code.
>
> john



Relevant Pages

  • Re: constructor and destructor
    ... I added a function for assignment operator and a copy ... > constructor and obtained the correct output. ... I had assumed the other way round, that the destructor is ... > Am I not calling the constructor explicitly here? ...
    (comp.lang.cpp)
  • Re: cant establish connection to Domino Server
    ... In Constructor of CABProvider ... WINAPI OpenServiceProfileSection ... In Destructor of CNotesExchExt ... AllocateAndCopyString ...
    (microsoft.public.outlook.interop)
  • Re: problem with destructor
    ... > but only constructors and destructor. ... Well the first thing to note is that you because it crashes in the ... private copy constructor and a private assignment operator. ...
    (comp.lang.cpp)
  • Re: Any experience with "The Last One"?
    ... In this International Standard, the examples, the notes, the ... xconstructor ... xdestructor ...
    (comp.programming)
  • Re: Best way to deal with long loops?
    ... var ts:TCallbackTimer; ... destructor TCallbackTimer.destroy; ... constructor TRunningAverage.Create; ... // and currenttick will be wrapped, ...
    (alt.comp.lang.borland-delphi)