mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 08:07:30 +09:00
Call the relevant scope-data constructor when allocating it, and poison/mark as undefined the memory for the trailing array of BindingNames, ratther than impermissibly PodZero-ing non-trivial classes.
This commit is contained in:
parent
4cbf54089a
commit
78d0ec7fc9
4 changed files with 72 additions and 31 deletions
|
|
@ -191,12 +191,12 @@ template <typename ConcreteScope>
|
|||
static UniquePtr<typename ConcreteScope::Data>
|
||||
NewEmptyScopeData(ExclusiveContext* cx, uint32_t length = 0)
|
||||
{
|
||||
uint8_t* bytes = cx->zone()->pod_calloc<uint8_t>(ConcreteScope::sizeOfData(length));
|
||||
uint8_t* bytes = cx->zone()->pod_malloc<uint8_t>(ConcreteScope::sizeOfData(length));
|
||||
if (!bytes)
|
||||
ReportOutOfMemory(cx);
|
||||
auto data = reinterpret_cast<typename ConcreteScope::Data*>(bytes);
|
||||
if (data)
|
||||
new (data) typename ConcreteScope::Data();
|
||||
new (data) typename ConcreteScope::Data(length);
|
||||
return UniquePtr<typename ConcreteScope::Data>(data);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue