1
General / Re: Segmentation Fault - SFML2
« on: August 02, 2012, 04:44:34 pm »
I don't know the context in which the GlobalDisplay instance is used well enough, but I'd either use some kind of lazy initialization method (like a Singleton), or have the user call an init() function manually, like SDL does. The latter would be my preferred route, although I'm a aware that's it's slightly opposed to the way your API is designed. I'd be happy with the Singleton, as long as it's a private interface, just the way it is now. One of the most basic C/C++ idioms should apply here, "you don't have to pay for what you don't use".
To fix the X11 stuff, I suggest a shutdown() function, which is responsible for destroying all SFML instances which are still alive. This is probably hard to implement in a clean way, but it would give users a surefire way to force all system calls to complete just before the end of main(), and to avoid the undeterministic static deinitialization mayhem.
Hopefully that did make sense...
To fix the X11 stuff, I suggest a shutdown() function, which is responsible for destroying all SFML instances which are still alive. This is probably hard to implement in a clean way, but it would give users a surefire way to force all system calls to complete just before the end of main(), and to avoid the undeterministic static deinitialization mayhem.
Hopefully that did make sense...