My class has this member.
std::vector<AvaWrapper> m_controls;
In my constructor I call
m_controls.clear()
Then I call a member function that does m_controls.clear() again but it blows up with an assert. The debugger shows that m_controls has a half million or more entries though none of them are valid cause the debugger shows "Error: expression cannot be evaluated" when I expand the tree. So, my intuition is that the class is not created correctly cause this code did work but I later derived a class from this class and I call new() to create the parent. In it's new role as a base class it's blowing up. The this pointer however shows all the other member variables have valid data so my hunch is wrong. The constructor is getting called too. Any ideas? Thanks.
UPDATE2:
Train::Train() : SpriteWindowFrame(200)
{
s_mutexProtectingTheGlobalData = new wxMutex();
m_window_rect = NULL;
m_thread = NULL;
m_ok = false;
m_accumulate_timer = new wxTimer();
m_accumulate_timer->SetOwner(this, ACCUMULATE_TIMER_ID);
m_autohide_timer = new wxTimer();
m_autohide_timer->SetOwner(this, AUTOHIDE_TIMER_ID);
m_autohide = false;
m_autohide_period = 5000;
m_controls.clear();
}
UPDATE:
//This version works.
SpaceInit::SpaceInit()
{
//Use INI config store. If you need something else, just
//create the appropriate object.
m_config_store = new IniConfigStore();
//Start up config.
Init();
m_t = new Trains();
return;
}
SpaceInit::~SpaceInit()
{
wxDELETE(m_config_store);
return;
}
I can do this: m_t->SomeMemberFunctionThatManipulatesVector()
and it works.
This one does not
SpaceInit::SpaceInit():Trains()
{
//Use INI config store. If you need something else, just
//create the appropriate object.
m_config_store = new IniConfigStore();
//Start up config.
Init();
return;
}
I can't do: SomeMemberFunctionThatManipulatesVector()
blows up on vector.
I've just noticed that the this pointer really is messed up inside the Train() default consturctor. I thought it wasn't but it is. The Trains constructor runs but everything is trashed.
My Trains constructor code is run of the mill. Just initialize things, new a couple things, etc. The SpaceInit is created with SpaceInit* t = new SpaceInit(); Train is a derived class so maybe that has something to do with it?