Segmentation fault when using custom classes ::Class() function

Ah, okay, so use TClassRef instead of a pointer to TClass* as a static member of TChannel? I didn’t know TClassRef existed, I’ll have to read up on that.

Thanks, I will let you know if that worked out.

TClassRef (when creating with a string) will delay the creation of the TClass until use (and cache the pointer value).

If fMnemonicClass is not used often, you can also consider simply dropping the member and replace it with a function:

TClass *GetMnemonicClass() { return TMnemonic::Class(); }

(or may be even asking if you need that member and/or function at all :slight_smile: ).

Using TClassRef did solve the problem. Thank you so much for your help with this!

fMnemonicClass isn’t used very often, but it is needed so that the libraries that get loaded during the run time of the program can change the class of the object stored in the member fMnemonic.

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