-
Notifications
You must be signed in to change notification settings - Fork 213
[GEN][ZH] Fix list element erasure with iterator on unrelated container in ResourceGatheringManager::findBestSupplyCenter, MilesAudioManager::killLowestPrioritySoundImmediately #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,7 +146,7 @@ void SubsystemInterfaceList::addSubsystem(SubsystemInterface* sys) | |
| void SubsystemInterfaceList::removeSubsystem(SubsystemInterface* sys) | ||
| { | ||
| #ifdef DUMP_PERF_STATS | ||
| for (SubsystemList::iterator it = m_allSubsystems.begin(); it != m_subsystems.end(); ++it) | ||
| for (SubsystemList::iterator it = m_allSubsystems.begin(); it != m_allSubsystems.end(); ++it) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a debug bug fix. No concern for retail game. |
||
| { | ||
| if ( (*it) == sys) { | ||
| m_allSubsystems.erase(it); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2087,9 +2087,9 @@ Bool MilesAudioManager::killLowestPrioritySoundImmediately( AudioEventRTS *event | |
|
|
||
| if( playing->m_audioEventRTS && playing->m_audioEventRTS == lowestPriorityEvent ) | ||
| { | ||
| //Release this 3D sound channel immediately because we are going to play another sound in it's place. | ||
| //Release this sound channel immediately because we are going to play another sound in it's place. | ||
| releasePlayingAudio( playing ); | ||
| m_playing3DSounds.erase( it ); | ||
| m_playingSounds.erase( it ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am 99% sure that this just worked with no bugs with stlport's implementation. iterator erase(iterator __position) {
_List_node_base* __next_node = __position._M_node->_M_next; // accesses next node
_List_node_base* __prev_node = __position._M_node->_M_prev; // accesses prev node
_Node* __n = (_Node*) __position._M_node; // accesses current node
__prev_node->_M_next = __next_node; // writes prev node
__next_node->_M_prev = __prev_node; // writes next node
_Destroy(&__n->_M_data); // calls destructor with the same type (PlayingAudio*)
this->_M_node.deallocate(__n, 1); // calls deallocate on default allocator for std::list
return iterator((_Node*)__next_node); // return local
}Same with So these were no runtime issues in the retail game.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is funny that it essentially looks like it does not care what container it is called on, just that erase is called with an iterator. |
||
| return TRUE; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This certainly was no runtime bug, because this pointer is just tested for null.