Segfault when making a Surface out of a Renderer object under some circumstances if logical_size was changed #3245
Labels
bug
Not working as intended
Experimental
Experimental code
segfault
For PRs that fix segfaults or issues containing segfaults which have an higher priority
Environment:
Current behavior:
If you make a
pygame._sdl2.video.Renderer
object and change it's logical_size attribute, then make a surface out of it withRenderer.to_surface()
, on some occasions the program will either segfault immediately, or it will run as normal but once it reaches the end it exits with segfaultIt's somewhat inconsistent, not every logical_size value will cause the segfault, and some of those who do don't cause it every time, but there are values that appear to segfault every time
Expected behavior:
The program should continue as normal and not segfault under any of these circumstances
Test code
All of these return something different every time they're run, so it's better to try them many times, saving or not the Surface in a variable doesn't seem to change the result
Not using it:
This will run as normal but once the script is done it segfaults,
logical_size
needs to be smaller than the window size but not every value causes it to act up, if it's bigger it will always work as intended apparentlyUsing a different value:
Notice how this is exactly the same as the first one but changing one of the 10's to 80 will make it segfault immediately on
ren.to_surface()
, having a 80 seems to segfault every time except when the other value is 1, in which case this happens: #3244There are other specific logical_size values that raise specific errors like (10,1) on a (90,2) sized window
Assigning other value to the Renderer object:
This will either segfault immediately at
ren = "huh?"
or it will (very rarely) continue but vomit a nasty Fatal Python error at the end of the script and then segfault (same error happens every time if you take the first example and set the window size to 90,2 and logical_size to 10,1)The text was updated successfully, but these errors were encountered: