fix gcc set corruption

This commit is contained in:
David Rose 2007-07-19 00:16:27 +00:00
parent c4c58208a2
commit 3b985045cb
2 changed files with 4 additions and 51 deletions

View File

@ -106,7 +106,10 @@ compare_to(const Effect &other) const {
if (_type != other._type) { if (_type != other._type) {
return _type.get_index() - other._type.get_index(); return _type.get_index() - other._type.get_index();
} }
return _effect - other._effect; if (_effect != other._effect) {
return _effect < other._effect ? -1 : 1;
}
return 0;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -662,13 +662,10 @@ return_new(RenderEffects *state) {
// The state was inserted; save the iterator and return the // The state was inserted; save the iterator and return the
// input state. // input state.
state->_saved_entry = result.first; state->_saved_entry = result.first;
// nassertr(validate_states(), pt_state);
nassertr(_states->find(state) == state->_saved_entry, pt_state); nassertr(_states->find(state) == state->_saved_entry, pt_state);
return pt_state; return pt_state;
} }
// nassertr(validate_states(), *(result.first));
// The state was not inserted; there must be an equivalent one // The state was not inserted; there must be an equivalent one
// already in the set. Return that one. // already in the set. Return that one.
return *(result.first); return *(result.first);
@ -688,56 +685,9 @@ release_new() {
nassertv(_states_lock->debug_is_locked()); nassertv(_states_lock->debug_is_locked());
if (_saved_entry != _states->end()) { if (_saved_entry != _states->end()) {
/*
if (_states->find(this) != _saved_entry) {
nassertv(*_saved_entry == this);
cerr << "States wrong!\n";
cerr << "validate = " << validate_states() << "\n";
cerr << "this = " << this << ": " << *this << "\n";
States::iterator fi = _states->find(this);
if (fi == _states->end()) {
cerr << " not found\n";
} else {
cerr <<" found: " << (*fi) << ": " << *(*fi) << "\n";
}
if (!_states->empty()) {
States::iterator si;
si = _states->begin();
cerr << (*si) << ": " << *(*si) << "\n";
States::iterator ni = si;
++ni;
if ((*si) == this) {
_states->erase(si);
si = ni;
}
while (ni != _states->end()) {
if (*(*si) < *(*ni)) {
cerr << " ok, " << (*(*ni) < *(*si)) << "\n";
} else {
cerr << " **wrong! " << (*(*ni) < *(*si)) << "\n";
}
si = ni;
cerr << (*si) << ": " << *(*si) << "\n";
++ni;
if ((*si) == this) {
_states->erase(si);
si = ni;
}
}
}
}
*/
nassertv(_states->find(this) == _saved_entry); nassertv(_states->find(this) == _saved_entry);
// nassertv(validate_states());
_states->erase(_saved_entry); _states->erase(_saved_entry);
_saved_entry = _states->end(); _saved_entry = _states->end();
/*
nassertd(validate_states()) {
cerr << "Removed " << this << ": " << *this << "\n";
}
*/
} }
} }