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:
Eugene Sandulenko 2013-12-10 22:22:51 +02:00
parent 789b4b694f
commit 6e6685a53d

View File

@ -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) {