Mike Nordell pointed me to the fact that BufferPool::ReleaseBuffers() didn't
free anything if it couldn't acquire the semaphore. That allowed me to get aware of a possible bug in the destructor :-) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1057 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -25,15 +25,19 @@ BufferPool::BufferPool()
|
|||||||
|
|
||||||
BufferPool::~BufferPool()
|
BufferPool::~BufferPool()
|
||||||
{
|
{
|
||||||
delete_sem(fLock);
|
|
||||||
delete_sem(fFreeBuffers);
|
delete_sem(fFreeBuffers);
|
||||||
|
|
||||||
|
acquire_sem(fLock);
|
||||||
|
// the return value doesn't interest us anymore
|
||||||
|
|
||||||
void **buffer = fFirstFree;
|
void **buffer = fFirstFree;
|
||||||
while (buffer != NULL) {
|
while (buffer != NULL) {
|
||||||
void **nextBuffer = (void **)*buffer;
|
void **nextBuffer = (void **)*buffer;
|
||||||
free(buffer);
|
free(buffer);
|
||||||
buffer = nextBuffer;
|
buffer = nextBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete_sem(fLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user