pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Changing from SCALED to SCALED RESIZEABLE window frequently causes segmentation fault on MacOS

Open Hato1 opened this issue 4 weeks ago • 2 comments
trafficstars

Environment:

Platform:		macOS-13.2-x86_64-i386-64bit
System:			Darwin
System Version:		Darwin Kernel Version 22.3.0: Thu Jan  5 20:53:49 PST 2023; root:xnu-8792.81.2~2/RELEASE_X86_64
Processor:		i386	SSE2: Yes	AVX2: Yes	NEON: No
Architecture:		Bits: 64bit	Linkage: 

Python:			CPython 3.12.10 (main, Apr  9 2025, 04:11:22) [Clang 20.1.0 ]
GIL Enabled:		True
pygame version:		2.5.6
SDL versions:		Linked: 2.32.10	Compiled: 2.32.10
SDL Mixer versions:	Linked: 2.8.1	Compiled: 2.8.1
SDL Font versions:	Linked: 2.24.0	Compiled: 2.24.0
SDL Image versions:	Linked: 2.8.8	Compiled: 2.8.8
Freetype versions:	Linked: 2.13.3	Compiled: 2.13.3

Display Driver:		Display Not Initialized
Mixer Driver:		Mixer Not Initialized

Current behavior:

Running pg.display.set_mode(SCREEN_SIZE, pg.SCALED) before pg.display.set_mode(SCREEN_SIZE, pg.SCALED | pg.RESIZABLE) results in a segmentation fault most of the time. MacOS prompts a crash report and the following is printed to terminal:

Fatal Python error: pygame_parachute: (pygame parachute) Segmentation Fault
Python runtime state: initialized

Current thread 0x00007ff85c9c6640 (most recent call first):
  File "test.py", line 5 in <module>

Extension modules: pygame.base, pygame.constants, pygame.rwobject, pygame.rect, pygame.bufferproxy, pygame.math, pygame.surflock, pygame.surface, pygame.window, pygame.display, pygame.draw, pygame.joystick, pygame.event, pygame.imageext, pygame.image, pygame.key, pygame.mouse, pygame.pixelcopy, pygame.mask, pygame.time, pygame.transform, pygame.font, pygame.mixer_music, pygame.mixer, pygame.scrap, pygame.system, pygame._freetype (total: 27)

Expected behavior:

Application should run without segfaulting.

Steps to reproduce:

Run the following script.

import pygame as pg
pg.init()
SCREEN_SIZE = (128, 128)
pg.display.set_mode(SCREEN_SIZE, pg.SCALED)
pg.display.set_mode(SCREEN_SIZE, pg.SCALED | pg.RESIZABLE)

Other modes can also be set, such as resizeable on both or hidden, but if scaled or resizeable are removed from either line the issue goes away. Issue is not present in Ubuntu.

Of 20 runs my results were: 16: Segmentation Fault 4: Code and window froze and had to be force quit 4: Code exited without error

Hato1 avatar Oct 21 '25 18:10 Hato1