1
0
Fork 0

(svn r22123) -Fix [FS#4522]: CommandQueue::Pop() did not update 'last'; popping the last item caused the queue to disconnect unless there was only one item.

release/1.2
frosch 2011-02-20 21:00:24 +00:00
parent 0eaa2ffa63
commit 77fa68c1da
1 changed files with 3 additions and 0 deletions

View File

@ -81,13 +81,16 @@ CommandPacket *CommandQueue::Pop(bool ignore_paused)
{ {
CommandPacket **prev = &this->first; CommandPacket **prev = &this->first;
CommandPacket *ret = this->first; CommandPacket *ret = this->first;
CommandPacket *prev_item = NULL;
if (ignore_paused && _pause_mode != PM_UNPAUSED) { if (ignore_paused && _pause_mode != PM_UNPAUSED) {
while (ret != NULL && !IsCommandAllowedWhilePaused(ret->cmd)) { while (ret != NULL && !IsCommandAllowedWhilePaused(ret->cmd)) {
prev_item = ret;
prev = &ret->next; prev = &ret->next;
ret = ret->next; ret = ret->next;
} }
} }
if (ret != NULL) { if (ret != NULL) {
if (ret == this->last) this->last = prev_item;
*prev = ret->next; *prev = ret->next;
this->count--; this->count--;
} }