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

[RF] RooCmdArgs copy pointers to temporaries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • master, 6.26/00
    • master
    • RooFit/RooStats
    • None
    • Ubuntu
      ROOT master

    Description

      When constructing RooCmdArgs, they might copy a pointer to a temporary. That leads to crashes when the temporary is destructed before the function that should receive the arguments is called:

      import ROOT
         
      ROOT.gInterpreter.Declare('''const RooArgSet * extractObj(const RooCmdArg& arg) {
         const RooArgSet* set = (const RooArgSet*) arg.getObject(0);
         return set;
      }''')
         
      x = ROOT.RooRealVar("x", "x title", 0, 0, 10)
      temp = ROOT.extractObj(ROOT.RooFit.NormSet( ROOT.RooArgSet(x) ))
      temp.Print("V")
      temp["x"].Print("V")
      

      In some cases, RooFit doesn't crash, but just gives the wrong result, see e.g.
      https://root-forum.cern.ch/t/createintegral-gives-unexpected-result/32627

      Attachments

        Issue Links

          Activity

            People

              rembserj Jonas Rembser
              shageboe Stephan Hageboeck
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: