Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Windows JoystickImpl exception thrown in WindowImpl constructor #701
The latest commit to the SFML repo seems to have a bug in Windows. It crashes on start up, I traced the culprits to be here:
I'm getting the following error:
I'm not really sure what this line is supposed to accomplish, it appears that its trying to erase the 256th character from the string for some reason. The crash makes sense since the string is never set to have 256 characters and ends up having fewer when the string is dynamically created.
Removing these lines from the code fixed the problem for me.
Interesting. That part of the code should probably be rewritten anyway. It's still using ANSI/wide char macros despite other parts of SFML forcing the wide character versions anyway. Will try to have a closer look at it tomorrow, unless someone else wants to do so.
The reason why the erase is there is to make sure that key names do not exceed 255 characters, as dictated by Microsoft documentation. If you remove the truncation, any time the name would be longer than 255 characters, "things would happen"
I merely refactored the old code, but forgot that erase is unconditional and throws an exception if there is nothing to erase. I'll fix this shortly, no worries