problem with destructor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karl Heinz Buchegger

    #16
    Re: problem with destructor

    bArT wrote:[color=blue]
    >
    > 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?
    >[/color]

    The block damage error message looks like the one generated by VC++.
    If you are working with VC++, you could also try to insert calls
    to AfxCheckMemory( ) in your code at strategic places and thus
    pin down the code position where the damage occours.


    --
    Karl Heinz Buchegger
    kbuchegg@gascad .at

    Comment

    • David Harmon

      #17
      Re: problem with destructor

      On Thu, 29 Jul 2004 18:33:52 +0200 in comp.lang.c++, "bArT"
      <bart212@poczta .onet.pl> wrote,[color=blue]
      >There isn't such possibility. All strings in constructor are not NULL.[/color]

      So then why does your constructor say:
      if (string1 != NULL)

      If you claim that, then your constructor should instead say
      assert(string1 != NULL);

      Comment

      • bArT

        #18
        Re: problem with destructor

        Ok, I solved the problem.
        I changed all char * into string (as somebody said here) and now everything
        works properly.
        Thanks everyone for help.

        bart


        Comment

        • Karl Heinz Buchegger

          #19
          Re: problem with destructor

          bArT wrote:[color=blue]
          >
          > Ok, I solved the problem.
          > I changed all char * into string (as somebody said here) and now everything
          > works properly.[/color]

          A strong indication that either
          * you somewhere wrote to the character array out of bounds.
          * you copied such an object without having a well behaved
          copy constructor
          * you assigned such an object without having a well behaved
          assignment operator

          --
          Karl Heinz Buchegger
          kbuchegg@gascad .at

          Comment

          Working...