Call ~ControlBlock

It's trivially destructible, but just in case. Compiler should optimize it out
This commit is contained in:
2025-09-11 13:18:19 -04:00
parent 10e382f633
commit 9cd83fc426

View File

@@ -182,8 +182,9 @@ private:
// Release the bias - decrement weak count for strong references
uint32_t prev_weak = control_block->decrement_weak();
// If weak count hits 0, free control block
// If weak count hits 0, destroy and free control block
if (prev_weak == 1) {
control_block->~ControlBlock();
std::free(control_block);
}
}
@@ -329,8 +330,9 @@ private:
if (control_block) {
uint32_t prev_weak = control_block->decrement_weak();
// If weak count hits 0, free control block
// If weak count hits 0, destroy and free control block
if (prev_weak == 1) {
control_block->~ControlBlock();
std::free(control_block);
}
}