Question about tree->GetUserInfo()

Dear ROOTers

I have the following code:

   for (Int_t k=0; k<n; k++) {
      XTreeInfo *info = 0;
      info = (XTreeInfo*)tree[k]->GetUserInfo()->FindObject(name);
      fAlgorithm->InitTreeInfo(info);

//??      SafeDelete(info);
   }

My question is:
Do I need to SafeDelete(info) or is this not allowed?

When I have the same code in different methods, which I call sequentially, do I need to SafeDelete(info) in every method?

Best regards
Christian

Hi,

Before deleting the object, you may want to remove it from the list.

If you do not intent in removing the object from the list, then you should not delete it.

Cheers,
Philippe.

Dear Philippe

Thank you for this information:

Since I need to call GetUserInfo() in different methods, I assume that I am not allowed to remove the object from list and thus should not delete it.

Best regards
Christian