@@ -117,10 +117,10 @@ TEnum *EnsureValidEnum(std::string_view enumName)
117117 return e;
118118}
119119
120- void EnsureValidAlignment (std::size_t align )
120+ void EnsureValidAlignment (std::size_t alignment )
121121{
122- if (align == 0 || align > ROOT ::RFieldBase:: kMaxAlignment || !ROOT::Internal::IsPowerOfTwo (align ))
123- throw ROOT::RException (R__FAIL (std::string (" invalid alignment: " ) + std::to_string (align )));
122+ if (!ROOT::Internal::IsValidAlignment (alignment ))
123+ throw ROOT::RException (R__FAIL (std::string (" invalid alignment: " ) + std::to_string (alignment )));
124124}
125125
126126// / Create a comma-separated list of type names from the given fields. Uses either the real type names or the
@@ -608,6 +608,8 @@ void ROOT::RClassField::ConstructValue(void *where) const
608608 fClass ->New (where);
609609}
610610
611+ ROOT ::RClassField::RClassDeleter::RClassDeleter(TClass *cl) : RDeleter(cl->GetClassAlignment ()), fClass(cl) {}
612+
611613void ROOT::RClassField::RClassDeleter::operator ()(void *objPtr, bool dtorOnly)
612614{
613615 fClass ->Destructor (objPtr, true /* dtorOnly */ );
@@ -886,6 +888,10 @@ void ROOT::Experimental::RSoAField::ConstructValue(void *where) const
886888 fSoAClass ->New (where);
887889}
888890
891+ ROOT ::Experimental::RSoAField::RSoADeleter::RSoADeleter(TClass *cl) : RDeleter(cl->GetClassAlignment ()), fSoAClass(cl)
892+ {
893+ }
894+
889895void ROOT::Experimental::RSoAField::RSoADeleter::operator ()(void *objPtr, bool dtorOnly)
890896{
891897 fSoAClass ->Destructor (objPtr, true /* dtorOnly */ );
@@ -1242,6 +1248,22 @@ std::unique_ptr<ROOT::RFieldBase::RDeleter> ROOT::RProxiedCollectionField::GetDe
12421248 return std::make_unique<RProxiedCollectionDeleter>(fProxy );
12431249}
12441250
1251+ ROOT ::RProxiedCollectionField::RProxiedCollectionDeleter::RProxiedCollectionDeleter(
1252+ std::shared_ptr<TVirtualCollectionProxy> proxy)
1253+ : RDeleter(proxy->GetCollectionClass ()->GetClassAlignment()), fProxy(proxy)
1254+ {
1255+ }
1256+
1257+ ROOT ::RProxiedCollectionField::RProxiedCollectionDeleter::RProxiedCollectionDeleter(
1258+ std::shared_ptr<TVirtualCollectionProxy> proxy, std::unique_ptr<RDeleter> itemDeleter, size_t itemSize)
1259+ : RDeleter(proxy->GetCollectionClass ()->GetClassAlignment()),
1260+ fProxy(proxy),
1261+ fItemDeleter(std::move(itemDeleter)),
1262+ fItemSize(itemSize)
1263+ {
1264+ fIFuncsWrite = RCollectionIterableOnce::GetIteratorFuncs (fProxy .get (), false /* readFromDisk */ );
1265+ }
1266+
12451267void ROOT::RProxiedCollectionField::RProxiedCollectionDeleter::operator ()(void *objPtr, bool dtorOnly)
12461268{
12471269 if (fItemDeleter ) {
@@ -1467,6 +1489,11 @@ void ROOT::RStreamerField::ConstructValue(void *where) const
14671489 fClass ->New (where);
14681490}
14691491
1492+ ROOT ::RStreamerField::RStreamerFieldDeleter::RStreamerFieldDeleter(TClass *cl)
1493+ : RDeleter(cl->GetClassAlignment ()), fClass(cl)
1494+ {
1495+ }
1496+
14701497void ROOT::RStreamerField::RStreamerFieldDeleter::operator ()(void *objPtr, bool dtorOnly)
14711498{
14721499 fClass ->Destructor (objPtr, true /* dtorOnly */ );
@@ -1868,7 +1895,7 @@ std::unique_ptr<ROOT::RFieldBase::RDeleter> ROOT::RVariantField::GetDeleter() co
18681895 for (const auto &f : fSubfields ) {
18691896 itemDeleters.emplace_back (GetDeleterOf (*f));
18701897 }
1871- return std::make_unique<RVariantDeleter>(fTagOffset , fVariantOffset , std::move (itemDeleters));
1898+ return std::make_unique<RVariantDeleter>(fTagOffset , fVariantOffset , GetAlignment (), std::move (itemDeleters));
18721899}
18731900
18741901size_t ROOT::RVariantField::GetAlignment () const
0 commit comments