Problem with destructor

Discussion in 'C++' started by Nafai, Mar 4, 2005.

  1. Nafai

    Nafai Guest

    Hello. I have a big problem. I need your help!

    I have a class whose only variable is a vector<char>.

    I get messages like this:

    *** glibc detected *** free(): invalid pointer: 0x089a6118 ***
    Aborted.

    I have looked up the error and it happens inside std::vector destructor.

    My destructor is just ~MyClass() {};

    What is happening?
     
    Nafai, Mar 4, 2005
    #1
    1. Advertising

  2. Nafai wrote:
    > Hello. I have a big problem. I need your help!
    >
    > I have a class whose only variable is a vector<char>.
    >
    > I get messages like this:
    >
    > *** glibc detected *** free(): invalid pointer: 0x089a6118 ***
    > Aborted.
    >
    > I have looked up the error and it happens inside std::vector destructor.
    >
    > My destructor is just ~MyClass() {};
    >
    > What is happening?


    Could be it's during the destruction of a derived class object through
    a pointer to the base class and the destructor is not virtual.

    V
     
    Victor Bazarov, Mar 4, 2005
    #2
    1. Advertising

  3. Nafai

    Nafai Guest

    Victor Bazarov escribió:
    > Nafai wrote:
    >
    >> Hello. I have a big problem. I need your help!
    >>
    >> I have a class whose only variable is a vector<char>.
    >>
    >> I get messages like this:
    >>
    >> *** glibc detected *** free(): invalid pointer: 0x089a6118 ***
    >> Aborted.
    >>
    >> I have looked up the error and it happens inside std::vector destructor.
    >>
    >> My destructor is just ~MyClass() {};
    >>
    >> What is happening?

    >
    >
    > Could be it's during the destruction of a derived class object through
    > a pointer to the base class and the destructor is not virtual.
    >
    > V


    There is no inheritance. I just have one class.
     
    Nafai, Mar 4, 2005
    #3
  4. * Nafai:
    > Hello. I have a big problem. I need your help!
    >
    > I have a class whose only variable is a vector<char>.
    >
    > I get messages like this:
    >
    > *** glibc detected *** free(): invalid pointer: 0x089a6118 ***
    > Aborted.
    >
    > I have looked up the error and it happens inside std::vector destructor.
    >
    > My destructor is just ~MyClass() {};
    >
    > What is happening?


    At line 542 the variable nGremlins is uninitialized.

    Show the code.

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Mar 4, 2005
    #4
  5. Nafai wrote:
    > [..]
    > There is no inheritance. I just have one class.


    Then the answer is in the FAQ 5.8.

    V
     
    Victor Bazarov, Mar 4, 2005
    #5
  6. Nafai

    Nafai Guest

    Victor Bazarov escribió:
    > Nafai wrote:
    >
    >> [..]
    >> There is no inheritance. I just have one class.

    >
    >
    > Then the answer is in the FAQ 5.8.
    >
    > V


    Where can I find the FAQ? Thanks.
     
    Nafai, Mar 4, 2005
    #6
  7. Nafai wrote:
    > Victor Bazarov escribió:
    >
    >> Nafai wrote:
    >>
    >>> [..]
    >>> There is no inheritance. I just have one class.

    >>
    >>
    >>
    >> Then the answer is in the FAQ 5.8.
    >>
    >> V

    >
    >
    > Where can I find the FAQ? Thanks.


    The location of the FAQ is given in the Welcome message. If you don't
    have this (or any of the past) week's Welcome messages on your server or
    in your downloaded messages, here is the Web copy of it, please start
    there: http://www.slack.net/~shiva/welcome.txt

    You only need to read the Welcome message once. Please don't stop and
    bail out of reading the Welcome message after you found the FAQ location.
    It is important that you read it fully.

    V
     
    Victor Bazarov, Mar 4, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tino
    Replies:
    2
    Views:
    936
    Ivan Vecerina
    Jun 24, 2003
  2. frs
    Replies:
    20
    Views:
    795
    Alf P. Steinbach
    Sep 21, 2005
  3. arun
    Replies:
    2
    Views:
    577
    benben
    Jun 13, 2006
  4. Jimmy Hartzell
    Replies:
    0
    Views:
    440
    Jimmy Hartzell
    May 19, 2008
  5. Jimmy Hartzell
    Replies:
    2
    Views:
    1,185
    Jimmy Hartzell
    May 20, 2008
Loading...

Share This Page