dtoolbase: Fix static destructor ordering issue

This commit is contained in:
rdb 2026-01-24 20:17:39 +01:00
parent 48215debb4
commit 0210384615
1 changed files with 3 additions and 2 deletions

View File

@ -167,8 +167,9 @@ get_deleted_chain(size_t buffer_size) {
static MutexImpl lock; static MutexImpl lock;
lock.lock(); lock.lock();
static std::set<DeletedBufferChain> deleted_chains; alignas(std::set<DeletedBufferChain>) static char storage[sizeof(std::set<DeletedBufferChain>)];
DeletedBufferChain *result = (DeletedBufferChain *)&*deleted_chains.insert(DeletedBufferChain(buffer_size)).first; static auto *deleted_chains = new (storage) std::set<DeletedBufferChain>;
DeletedBufferChain *result = (DeletedBufferChain *)&*deleted_chains->insert(DeletedBufferChain(buffer_size)).first;
lock.unlock(); lock.unlock();
return result; return result;
} }