Getting "Pure virtual function called!" when drawing TLegend


_ROOT Version: 6.19
_Platform: OS 10.14.3


My code runs perfectly IF I don’t put the legend, because when I write

legend.Draw()

My codes terminates and the terminals says:

libc++abi.dylib: Pure virtual function called!

However I can write the TLegend IF I don’t change the text size, which I really do need to do.

To change the text size I’m doing:

    entry = legend.GetListOfPrimitives().First() #for the header
    entry.SetTextSize(0.03)
    entry = legend.AddEntry(h1, material1 + ' with ' + source1 + ' as light source', 'F')
    entry.SetTextSize(0.03)

I’m not sure why this is a problem now, I have done it before, but if I comment those lines everything works

EDIT: I solved this by doing

legend.SetTextSize(0.3)

instead of

    entry = legend.GetListOfPrimitives().First() #for the header
    entry.SetTextSize(0.03)
1 Like

Could you post you a macro reproducing the problem that we can run?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.