mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-06 18:00:44 +00:00
FULLPIPE: Remove premature optimization in GlobalMessageQueueList::compact()
This fixes freeze in intro and most probably tons of other stuff. Kudos go to eriktorbjorn for debugging it.
This commit is contained in:
parent
789b4b694f
commit
6e6685a53d
@ -557,16 +557,33 @@ void GlobalMessageQueueList::disableQueueById(int id) {
|
||||
}
|
||||
|
||||
int GlobalMessageQueueList::compact() {
|
||||
int *useList = new int[size() + 2];
|
||||
|
||||
for (uint i = 0; i < size() + 2; i++)
|
||||
useList[i] = 0;
|
||||
|
||||
for (uint i = 0; i < size();) {
|
||||
if (((MessageQueue *)_storage[i])->_isFinished) {
|
||||
disableQueueById(_storage[i]->_id);
|
||||
remove_at(i);
|
||||
} else {
|
||||
if (_storage[i]->_id < size() + 2)
|
||||
useList[_storage[i]->_id] = 1;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return size() + 1;
|
||||
uint i;
|
||||
|
||||
for (i = 1; i < size() + 2; i++) {
|
||||
if (!useList[i]) {
|
||||
delete [] useList;
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
|
||||
|
Loading…
Reference in New Issue
Block a user