Call ~ControlBlock
It's trivially destructible, but just in case. Compiler should optimize it out
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user