Skip to content

copying a default constructed TH2Poly fails. #16771

@pcanal

Description

@pcanal

See cms-sw/cmssw#41932 (comment)

// This produces errors
TH2Poly p1;
TH2Poly p2(p1);

The stack trace is:

  * frame #0: 0x000000010515b3d4 libHist.so`TH2Poly::Copy(this=0x00000001000100a8, newobj=0x00000001000180a8) const at TH2Poly.cxx:235:49
    frame #1: 0x000000010515add8 libHist.so`TH2Poly::TH2Poly(this=0x00000001000180a8, rhs=0x00000001000100a8) at TH2Poly.cxx:185:9
    frame #2: 0x000000010515ae34 libHist.so`TH2Poly::TH2Poly(this=0x00000001000180a8, rhs=0x00000001000100a8) at TH2Poly.cxx:184:47

with a missing if not nullptr at:

234      // need to use Clone to copy the contained bin list
-> 235      newth2p.fBins = dynamic_cast<TList *>(fBins->Clone());

As a side note:

// This works fine (initialized case)
TH2Poly p1;
Double_t x[] = {0,0,1,1};
Double_t y[] = {0,1,1,0};
p1.AddBin(4, x, y);
TH2Poly p2(p1);

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions