Skip to content

[core] proper check whether class is a TRef or TRefArray #14930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions core/meta/src/TStreamerElement.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "ThreadLocalStorage.h"
#include "TList.h"
#include "TRef.h"
#include "TRefArray.h"
#include "TInterpreter.h"
#include "TError.h"
#include "TObjArray.h"
Expand Down Expand Up @@ -287,7 +288,7 @@ Bool_t TStreamerElement::CannotSplit() const
}

////////////////////////////////////////////////////////////////////////////////
/// Returns a pointer to the TClass of this element.
/// Returns a pointer to the TClass of this element and updates fClassObject.

TClass *TStreamerElement::GetClassPointer() const
{
Expand All @@ -305,9 +306,11 @@ TClass *TStreamerElement::GetClassPointer() const

Int_t TStreamerElement::GetExecID() const
{
//check if element is a TRef or TRefArray
if (strncmp(fTypeName.Data(),"TRef",4) != 0) return 0;

//check if element is a TRef or TRefArray; or if it inherits from them and class was preloaded
const TString clName = ExtractClassName(fTypeName);
TClass* const type = TClass::GetClass(clName, kFALSE, kTRUE); // do NOT update fClassObject via GetClassPointer ! and do NOT call GetClass with load=true, otherwise you'll get several failing roottests. Do NOT call TRef::Class() or TRefArray::Class() either
if (clName != "TRef" && clName != "TRefArray" && (!type || !(type->InheritsFrom(TClass::GetClass("TRef", kFALSE, kTRUE)) || type->InheritsFrom(TClass::GetClass("TRefArray", kFALSE, kTRUE))))) return 0;

//if the UniqueID of this element has already been set, we assume
//that it contains the exec id of a TRef object.
if (GetUniqueID()) return GetUniqueID();
Expand Down
Loading