dtoolbase: Fix static destructor ordering issue
This commit is contained in:
parent
48215debb4
commit
0210384615
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue