Skip to content

Commit 384b44a

Browse files
committed
[meta] Return exec id of TRef, TRefArray and derived data members
Instead of all data members the type of which has a name beginning with "TRef". Fixes ROOT-7052
1 parent 031f6bd commit 384b44a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

core/meta/src/TStreamerElement.cxx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
* For the list of contributors see $ROOTSYS/README/CREDITS. *
1010
*************************************************************************/
1111

12-
//////////////////////////////////////////////////////////////////////////
13-
// //
14-
// //
15-
//////////////////////////////////////////////////////////////////////////
16-
17-
1812
#include "TROOT.h"
1913
#include "TStreamerElement.h"
2014
#include "TVirtualStreamerInfo.h"
@@ -308,8 +302,15 @@ TClass *TStreamerElement::GetClassPointer() const
308302

309303
Int_t TStreamerElement::GetExecID() const
310304
{
311-
//check if element is a TRef or TRefArray
312-
if (strncmp(fTypeName.Data(),"TRef",4) != 0) return 0;
305+
TString typeName = fTypeName;
306+
if (typeName != "TRef" && typeName != "TRefArray") {
307+
// It's not a ROOT standard TRef or TRefArray class, but it could be a user class
308+
// inheriting from it (see ROOT-7052)
309+
const TString clName = ExtractClassName(fTypeName);
310+
const auto cl = TClass::GetClass(clName, kFALSE, kTRUE);
311+
if (!cl || (nullptr == cl->GetBaseClass("TRef") && nullptr == cl->GetBaseClass("TRefArray")))
312+
return 0;
313+
}
313314

314315
//if the UniqueID of this element has already been set, we assume
315316
//that it contains the exec id of a TRef object.

0 commit comments

Comments
 (0)