You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using pygame._sdl2.Renderer.to_surface(), if the application window is fullscreen(desktop=True) and pygame._sdl2.Renderer.logical_size has been set., this results in a segmentation fault. If the application is windowed then the segmentation fault does not occur.
Expected behaviour:
Segmentation fault is not experienced and program continues normally.
Screenshots
Steps to reproduce:
Create a window using pygame.Window()
Create a renderer using pygame._sdl2.Renderer()
Set a logical size for the renderer using pygame._sdl2.Renderer.logical_size()
Set the window to fullscreen using desktop resolution using pygame.Window.set_fullscreen(desktop=True)
Try to take a copy of the renderer and output to a surface using pygame._sdl2.Renderer.to_surface()
Test code
Use the 'Space' key to toggle between windowed and fullscreen. Use the 'R' key to perform the renderer copy to a surface.
import pygame
import pygame._sdl2 as sdl2
pygame.init()
WINDOW = pygame.Window("Test Window", (800, 600))
RENDERER = sdl2.Renderer(WINDOW)
RENDERER.draw_color = "blue"
RENDERER.logical_size = (800, 600)
fullscreen = False
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.WINDOWCLOSE:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
running = False
elif event.key == pygame.K_r:
new_surface = RENDERER.to_surface()
elif event.key == pygame.K_SPACE:
if fullscreen:
WINDOW.set_windowed()
else:
WINDOW.set_fullscreen(desktop=True)
fullscreen = not fullscreen
RENDERER.clear()
RENDERER.present()
rethanon
changed the title
Seg fault in pygame._sdl2.Renderer.to_surface()
Seg fault in pygame._sdl2.Renderer.to_surface() when pygame._sdl2.Renderer.logical_size has been set
Aug 2, 2024
damusss
added
segfault
For PRs that fix segfaults or issues containing segfaults which have an higher priority
_sdl2
pygame._sdl2
labels
Aug 3, 2024
Environment:
Platform: Windows-11 OS build 22631.3958
System: Windows
System Version: 10.0.22631
Processor: AMD Ryzen9 5900X
Python: Python 3.12.2
pygame-ce version: 2.5.0
SDL versions: 2.30.3
Display Driver: windows
Current behaviour:
When using pygame._sdl2.Renderer.to_surface(), if the application window is fullscreen(desktop=True) and pygame._sdl2.Renderer.logical_size has been set., this results in a segmentation fault. If the application is windowed then the segmentation fault does not occur.
Expected behaviour:
Segmentation fault is not experienced and program continues normally.
Screenshots
Steps to reproduce:
Test code
Use the 'Space' key to toggle between windowed and fullscreen. Use the 'R' key to perform the renderer copy to a surface.
Stack trace/error output/other error logs
The text was updated successfully, but these errors were encountered: