Problem with destructor

N

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?
 
V

Victor Bazarov

Nafai said:
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
 
N

Nafai

Victor Bazarov escribió:
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.
 
A

Alf P. Steinbach

* 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.
 
V

Victor Bazarov

Nafai said:
Victor Bazarov escribió:
Nafai said:
[..]
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top