void Container::updateChildren() {
if(!hasChildren()) {
return;
}
std::list<ControlPtr>::iterator iter;
for(iter = _children.begin(); iter != _children.end(); iter++) {
(*iter)->update(); // <- EXC_BAD_ACCESS
}
}
ControlPtr is a boost::shared_ptr<Control>
exc_bad_access on virtual method?
So I have this hierarchy of classes for my UI. The way this is setup now is: FPSCounter is a Label is a Control
in my Control class I define
virtual void update() { }
Now way down in FPSCounter, I want to implement the update method. However, when I iterate through a list of Controls (which currently only consists of the FPSCounter), I get a exc_bad_access. What would cause this?
Maybe you called your update function on a null-pointer?
Next time youn get the assert, look at the contents of iter
I'd also add an assert - just to be sure ^^
Next time youn get the assert, look at the contents of iter
I'd also add an assert - just to be sure ^^
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement