Hi,
I am using an automatically generated streamer, and it segfaults. I can work around it, but I don’t understand why it is being generated in a particular way, and what the appropriate fix is.
I have a container class Container that inherits publicly from TObject. Container contains a private member pointer to Member_Derived which inherits publicly from an abstract class Member that Inherits publicly from TObject.
Member_Derived::Write works.
Container::Write crashes at TBuffer::WriteObject, and making the pointer to Member_Derived non persistent, ie changing
into
doesn’t produce the crash, but I need to store the object.
If I go into the automatically generated Container::Streamer(TBuffer &R__b) and change the line
to
then everything works. I have noticed that member pointers to native root objects (like TH1F*'s ) always seem to have this upcast in streamers.
Questions: Why does upcasting to TObject work? What would solve this problem without me needing to manually edit the auto-generated root dictionary?