The block_cache::LowMemoryHandler() must check if it could acquire the cache's lock;

it might have been deleted in the mean time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15565 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-16 15:50:13 +00:00
parent 182f88dda1
commit 4c0f46e2a3

View File

@ -350,6 +350,13 @@ block_cache::LowMemoryHandler(void *data, int32 level)
block_cache *cache = (block_cache *)data;
BenaphoreLocker locker(&cache->lock);
if (!locker.IsLocked()) {
// If our block_cache were deleted, it could be that we had
// been called before that deletion went through, therefore,
// acquiring its lock might fail.
return;
}
TRACE(("block_cache: low memory handler called with level %ld\n", level));
// free some blocks according to the low memory state