mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
CPU/CodeCache: Call Block constructor/destructor
Fixes crash in MSVC Debug build.
This commit is contained in:
parent
03592e8de8
commit
8ce2be57c5
|
@ -442,6 +442,7 @@ CPU::CodeCache::Block* CPU::CodeCache::CreateBlock(u32 pc, const BlockInstructio
|
||||||
Assert(it != s_blocks.end());
|
Assert(it != s_blocks.end());
|
||||||
s_blocks.erase(it);
|
s_blocks.erase(it);
|
||||||
|
|
||||||
|
block->~Block();
|
||||||
std::free(block);
|
std::free(block);
|
||||||
block = nullptr;
|
block = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -452,6 +453,7 @@ CPU::CodeCache::Block* CPU::CodeCache::CreateBlock(u32 pc, const BlockInstructio
|
||||||
block =
|
block =
|
||||||
static_cast<Block*>(std::malloc(sizeof(Block) + (sizeof(Instruction) * size) + (sizeof(InstructionInfo) * size)));
|
static_cast<Block*>(std::malloc(sizeof(Block) + (sizeof(Instruction) * size) + (sizeof(InstructionInfo) * size)));
|
||||||
Assert(block);
|
Assert(block);
|
||||||
|
new (block) Block();
|
||||||
s_blocks.push_back(block);
|
s_blocks.push_back(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,7 +712,10 @@ void CPU::CodeCache::ClearBlocks()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (Block* block : s_blocks)
|
for (Block* block : s_blocks)
|
||||||
|
{
|
||||||
|
block->~Block();
|
||||||
std::free(block);
|
std::free(block);
|
||||||
|
}
|
||||||
s_blocks.clear();
|
s_blocks.clear();
|
||||||
|
|
||||||
std::memset(s_lut_block_pointers.get(), 0, sizeof(Block*) * GetLUTSlotCount(false));
|
std::memset(s_lut_block_pointers.get(), 0, sizeof(Block*) * GetLUTSlotCount(false));
|
||||||
|
|
Loading…
Reference in a new issue