Skip to content

Commit

Permalink
io: for rule input don't use virtual function if class changed
Browse files Browse the repository at this point in the history
  • Loading branch information
pcanal committed Jan 19, 2025
1 parent a07b28f commit 4a60b1a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions io/io/src/TStreamerInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,13 @@ namespace {
memType = TVirtualStreamerInfo::kAnyP;
}
} else {
if (memClass->IsTObject()) {
memType = TVirtualStreamerInfo::kObject;
} else if (memClass->GetCollectionProxy()) {
if (memClass->GetCollectionProxy()) {
memType = TVirtualStreamerInfo::kSTL;
} else if(memClass->IsTObject() && memClass == element->GetClassPointer()) {
// If there is a change in the class type, we can't use the TObject::Streamer
// virtual function: it would streame the data using the in-memory type rather
// than the onfile type.
memType = TVirtualStreamerInfo::kObject;
} else {
memType = TVirtualStreamerInfo::kAny;
}
Expand Down Expand Up @@ -349,6 +352,13 @@ namespace {
void UpdateFromRule(const TStreamerInfo *info, const ROOT::TSchemaRule::TSources *s, TStreamerElement *element)
{
auto [memClass, memType, datasize, dimensions, totaldim] = GetSourceType(s, element);
if (element->GetType() == TVirtualStreamerInfo::kObject && memClass != element->GetClassPointer())
{
// If there is a change in the class type, we can't use the TObject::Streamer
// virtual function: it would streame the data using the in-memory type rather
// than the onfile type.
element->SetType(TVirtualStreamerInfo::kAny);
}
element->SetNewType( memType );
element->SetNewClass( memClass );
// We can not change the recorded dimensions. Let's check that
Expand Down

0 comments on commit 4a60b1a

Please sign in to comment.