From 89c3592b514cc177898a9c951cc0742df76c30b7 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 23 Mar 2026 14:07:18 -0400 Subject: [PATCH] BBlockCache: Initialize the mutex unconditionally. Otherwise we may get assertion failures under the debug heaps. --- src/kits/support/BlockCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kits/support/BlockCache.cpp b/src/kits/support/BlockCache.cpp index a509382b27..f54b4d9c0b 100644 --- a/src/kits/support/BlockCache.cpp +++ b/src/kits/support/BlockCache.cpp @@ -45,6 +45,8 @@ BBlockCache::BBlockCache(uint32 blockCount, size_t blockSize, fFreeBlocks(0), fBlockCount(blockCount) { + pthread_mutex_init(&fLock, NULL); + switch (allocationType) { case B_OBJECT_CACHE: fAlloc = &operator new[]; @@ -61,8 +63,6 @@ BBlockCache::BBlockCache(uint32 blockCount, size_t blockSize, if (heap_debug_get_allocation_info != NULL) return; - pthread_mutex_init(&fLock, NULL); - // To properly maintain a list of free buffers, a buffer must be // large enough to contain the _FreeBlock struct that is used. if (blockSize < sizeof(_FreeBlock))