New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High value for Window antialiasingLevel causes frequent segfaults on macOS #1582
Comments
This might be stating the obvious, but as a random drive-by thought: could something be treating a value as The inconsistent nature is a bit of a twist though. Also does any other OpenGL library have the same issue on the same machine? |
@follower That is an interesting thought! For what it's worth, I will add that I did happen to stumble upon the issue originally due to storing a signed integer in an unsigned variable, causing the value to jump to the large one as documented. I have considered modifying the demo program posted above to use exact literals rather than expressions using the
Yes indeed it is! My guess is it might be a platform-specific implementation detail, perhaps some overlooked constraint in the SFML code which interacts with the macOS-specific OpenGL API...
Good question —I'm afraid I'm unable to answer that one though, I do not have any OpenGL programming experience. The only graphics programming I have done is with SDL and SFML. However, from doing a bit of searching within the SFML code, if I'm not mistaken then the |
@follower If you or someone else would be able to guide me in creating or supply a minimal test program for verifying if the issue is to do with OpenGL itself, I would be happy to test such a program on my Mac and Linux machines, if it would be useful. |
The joys of unitialised variables... #1610 will fix the segfault, but to be honest I don't think there's anything else we can do about this issue. It may well be a signed/unsigned conversion somewhere in the apple code, but it's an extreme edge case and the best we could do is just log an extra error saying to use reasonable AA values |
Hooray! I appreciate that someone took the time to look into it, understand totally that it's an extreme edge-case, that there is now a proposal to add additional code in SFML to handle this gracefully feels like the right way to handle it, thanks! |
I'd say this can probably be closed now |
This was fixed with #1610 Not sure if it's really worth adding checks for "sane" values. |
Subject of the issue
When a suitably high value is given for the
antialiasingLevel
member ofContextSettings
,Window
objects created with these settings almost always (but not every time) crash the program with a segmentation fault.Your environment
-Wl,-rpath
and-framework
for linking to the SFML libraries.Steps to reproduce
Compile this code with
clang++ sfml_bug_demo.cpp -o sfml-bug-demo -Wl,-rpath,/Library/Frameworks -framework sfml-graphics -framework sfml-window -framework sfml-system
:Expected behavior
The Window should be created and then immediately disappear (probably with a message on the console indicating that the exact requested settings could not be fulfilled, owing to the ridiculously large value for the antialiasing level).
Actual behavior
Almost every time the program is run, this is the only output on the console:
Very rarely, this output appears instead:
Notes
antialiasingLevel
being in the range0..(UINT_MAX / 2)
, which is0..2147483647
on my system.The text was updated successfully, but these errors were encountered: