* delete_owned_ports() did not maintain the sUsedPorts variable, and thus led

to bug #4864.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33823 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-10-29 08:08:31 +00:00
parent f532a74ba9
commit 8cd9a52477

View File

@ -606,10 +606,25 @@ delete_owned_ports(struct team* team)
list_move_to_list(&team->port_list, &queue);
}
int32 firstSlot = sMaxPorts;
int32 count = 0;
while (port_entry* port = (port_entry*)list_remove_head_item(&queue)) {
if (firstSlot > port->id % sMaxPorts)
firstSlot = port->id % sMaxPorts;
count++;
MutexLocker locker(port->lock);
uninit_port_locked(*port);
}
MutexLocker _(sPortsLock);
// update the first free slot hint in the array
if (firstSlot < sFirstFreeSlot)
sFirstFreeSlot = firstSlot;
sUsedPorts -= count;
}