Hello,
I'm using SFML
f5b9c7e2160e758f32aa6453c9f6b001fabbcca8 straight from GitHub. I have compiled it aswith MS VC++ 2005 Express Edition, using the project files generated by CMake. (BTW,
this isn't supported by VC++ 2005. Not that it really matters I guess.)
It is statically linked to
this program, a generic archive/resource/map editor for Doom engine games. The problem is what happens when the SFML code is called to render some text. When quitting afterwards, the program crashes, with exception c0000005 (access violation). I have tried debug, release, and minsizerel builds, with no difference in outcome.
Important note: this doesn't seem to happen when compiled with Visual Studio 2010 or 2012, as the other developer working on the same project doesn't run into the issue anymore, though he did with the RC version.
What happens is that there are several global sf::Font instances that are created when the application is started. Much later, at the user's input, they might be used to draw text, on a RenderWindow that is created when needed. This happens notably when using the map editor part of the app.
I have found out that if instead of setting text directly to one of the global fonts, I instead create a clone of it with the copy constructor, then I do not get the appcrash on exit. However, this hurts performances, since the font is copied every time text is drawn. (And it is
horribly ugly code anyway.)
I have no idea what to do. Looking at the
closed ticket and
related thread, it seems I'm getting a bug that has been fixed for other people. Is it VC++ 2005's fault? Or is there an obscure platform-version conditional somewhere in SFML that creates this difference?