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

TPad tries to delete anything that is drawn in it

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • High
    • Resolution: Clarified
    • 6.17/01
    • None
    • Graphics, PyROOT
    • None
    • Centos7, Python3

    Description

      The following code:

        TCanvas *c1 = new TCanvas( "c1", "Histogram Drawing Options", 200, 10, 700, 900 );
        TPad *pad1 = new TPad( "pad1", "The pad with the function",  0.03, 0.62, 0.50, 0.92, 21 );
       
        pad1->cd();
        TPaveLabel *label1 = new TPaveLabel( -3.5, 700, -1, 800, "Default option" );
        label1->Draw();
       
        delete label1;
        delete pad1;
      

      emits the following warning:

      Error in <TList::Clear>: A list is accessing an object (0x14c1bb0) already deleted (list name = TList)
      

      The issue is that the TPaveLabel is deleted before the TPad. When the TPad is deleted, there is some internal list of the TPad where the TPaveLabel has been registered and a new attempt to delete the TPad is performed. This applies to any object that is drawn in the TPad, not just the TPaveLabel.

      The reproducer in Python:

      from ROOT import TCanvas, TPad, TPaveLabel
      from ROOT import gROOT
       
      c1 = TCanvas( 'c1', 'Histogram Drawing Options', 200, 10, 700, 900 )
      pad1 = TPad( 'pad1', 'The pad with the function',  0.03, 0.62, 0.50, 0.92, 21 )
       
      pad1.cd()
       
      label1 = TPaveLabel( -3.5, 700, -1, 800, 'Default option' )
      label1.Draw()
      

      Attachments

        Activity

          People

            couet Olivier Couet
            etejedor Enric Tejedor Saavedra
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Actual End: