Z
Zeppe
Eric said:I created a singleton class as in the example below. The application
sporadically crashes in the second line of the main function as shown.
However, when I change the singleton such that the static pointer is a
class member (defined in the cpp file) and the instance function
creates the object if the pointer is NULL, then it works fine. I would
appreciate any explanations as to why this happens.
There seems not to be anything bad in your code (except from not having
the choice of deallocating the pointer, doing that way). Could it be
some static variable initialization order in the context in which you
use it?
Regards,
Zeppe