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

[TTree] Deleted friend trees are not deregistered from their friend

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 6.24/00, 6.26/00
    • master, 6.16/00
    • TTree
    • None
    • any

    Description

      The problem appears for RecursiveRemove'd trees as well as trees owned by TChains.

      First observed in ROOT-9281.

      Minimal reproducer (the tree clone is only introduced to trigger a crash):

      #include <TTree.h>
      #include <iostream>
       
      int main()
      {
         auto tree = new TTree("t", "t");
         auto friendTree = new TTree("s", "s");
         tree->AddFriend(friendTree);
         TTree cloneTree("q", "q");
         tree->AddClone(&cloneTree);
         int x;
         cloneTree.Branch("x", &x);
       
         delete friendTree;
         // prints 1 although the friend is already deleted
         std::cout << tree->GetListOfFriends()->GetEntries() << std::endl;
         // crashes trying to access the contents of the friend TTree
         delete tree;
         return 0;
      }
      

      Attachments

        Activity

          People

            pcanal Philippe Canal
            eguiraud Enrico Guiraud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: