Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-8946

TClass::GetListOfAllPublicDataMembers->FindObject() returns wrong pointers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 6.08/02
    • Fix Version/s: 6.08/08, 6.12/00, 6.10/06
    • Labels:
      None
    • Environment:

      uname -a:
      Linux ms03b 2.6.38 #19 SMP Tue Aug 14 09:15:44 CEST 2012 x86_64 x86_64 x86_64 GNU/Linux

      ROOTSYS=/cvmfs/sft.cern.ch/lcg/releases/LCG_87/ROOT/6.08.02/x86_64-slc6-gcc49-opt

      Description

      The function TClass::GetListOfAllPublicDataMembers returns a TViewPubDataMembers. Issuing TViewPubDataMembers::FindObject("dm") should return the pointer to the datamember named "dm" if it exists as public data member in the class or its base classes, and 0 otherwise. However, it returns a seemingly random pointer to another data member in case of inherited public data members, and also for arbitrary arguments. On the command line:

      % root -n
      // load some class object
      root [0] cl = gROOT->GetClass("TNamed") (TClass *) 0x1263640

      // normal, expected behavior for data members (inherited from TObject):
      root [1] cl->GetListOfAllPublicDataMembers()->FindObject("kIsOnHeap")
      (TObject *) 0x1efd400
      root [2] cl->GetListOfAllPublicDataMembers()>FindObject("kIsOnHeap")>GetName()
      (const char *) "kIsOnHeap"

      // wrong pointer returned (also from TObject):
      root [3] cl->GetListOfAllPublicDataMembers()->FindObject("kZombie")
      (TObject *) 0x1f08fc0
      root [4] cl->GetListOfAllPublicDataMembers()>FindObject("kZombie")>GetName()
      (const char *) "kNotDeleted"

      // this should definitely return a nullptr:
      root [5] cl->GetListOfAllPublicDataMembers()->FindObject("foo_bar")
      (TObject *) 0x1f13fe0
      root [6] cl->GetListOfAllPublicDataMembers()>FindObject("foo_bar")>GetName()
      (const char *) "kNoContextMenu"

        Attachments

          Activity

            People

            Assignee:
            pcanal Philippe Canal
            Reporter:
            skaphle Stephan Kaphle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Actual End: