ofxTurboJpeg bug that only happens in a custom class

While using @armadillu 's ofxTurboJpeg, I get this error, but only in a very specific use case:

[ error ] ofxTurboJpeg: Error in tjDecompressHeader2():tjDecompressHeader3(): Instance has not been initialized for decompression

The use case is when, in my class “ImagePlayer”, I use a class member ofxTurboJpeg on the target of a shared_ptr. Ie. the ofxTurboJpeg is declared in ImagePlayer.h and used in ImagePlayer.cpp

The problem doesn’t happen if ofxTurboJpeg is a member of the ofApp class and I do this in ofApp.cpp.

It also doesn’t happen if declare ofxTurboJpeg locally inside my class method:

    ofxTurboJpeg t;
	t.load(*photo, path);

So there’s really no problem since I can just do the above, but I’m wondering what the cause of this is.

hard to tell without more context; can you post your specific shared_ptr dysfunctional code?