Debug Assertion Failed std::vector push_back

Started by
4 comments, last by Blacksmith_Tony 20 years, 2 months ago
Hi all, I''m having a problem attempting to push an instance of one of my classes onto the end of a vector. The following is the code that causes the problem:

//theTextPanels is declared like: vector <TBTextPanel> theTextPanels;

TBTextPanel textControl;
theTextPanels.push_back(textControl);
When the push_back is called the following error is shown: Debug Assertion Failed File: dbgheap.c Line: 1044 Expression: crtIsValidHeapPointer(pUserData) I''ve stripped the TBTextPanel class down so all it contains is its constructor and destructor. The strange thing is that I have another class that I have done the same to but when using push_back on that it works fine. Also if I make the TBTextPanel inherit from TBControl and then add it to a vector of TBControls it doesn''t throw up an error. But still does if I add it to a vector of TBTextPanels. All references to this error I have seen while searching seem to relate to deleting pointers etc. If anyone could help I would be grateful. Thanks.
Advertisement
What''s the copy constructor and destructor look like for TBTextPanel?
I''m using the default copy constructor/destructor i.e. I haven''t defined one.

It seems strange that I would need to since I don''t have member variables in the TBTextPanel class. Also the program dies before the textControl instance of TBTextPanel is destroyed.



By any chance does your code involve DLLs in any way?
If you''re using visual studio, you might try a "rebuild all" just in case. Occasionally it has trouble compiling when only parts of your code need recompiling.


"Unfortunatly, when I sent the email, instead of writing "Best Regards" I ended up writing "Best Retards." - boolean
-~-The Cow of Darkness-~-
Hah, doing a rebuild all fixed the problem, thats all it took for a problem thats lasted two days .

Thanks all.

This topic is closed to new replies.

Advertisement