- // This will come back and remove
- // the current item each time. Is - // that OK? No, it is not OK. This messes up the vector and confuses the iterator. And it leads to crashes. Better read the vector in reverse order.
This commit is contained in:
@@ -2286,12 +2286,8 @@ SGPropertyNode::hash_table::hashcode (const char * key)
|
||||
|
||||
SGPropertyChangeListener::~SGPropertyChangeListener ()
|
||||
{
|
||||
// This will come back and remove
|
||||
// the current item each time. Is
|
||||
// that OK?
|
||||
vector<SGPropertyNode *>::iterator it;
|
||||
for (it = _properties.begin(); it != _properties.end(); it++)
|
||||
(*it)->removeChangeListener(this);
|
||||
for (int i = _properties.size() - 1; i >= 0; i--)
|
||||
_properties[i]->removeChangeListener(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user