When I try to use fill
with a Surface using both the rect
and special_flags
arguments, pygame lags for a few seconds, then crashes without notification, if I have named rect dimensions that escape the Surface's area.
Here're the results of a test using IDLE:
>>> import pygame
>>> test_surf = pygame.Surface((50,50))
>>> test_rgba = 50,100,150,200 # arbitrary
>>> test_rect = 33,33,33,33 # these dimensions are 16px too large on each axis.
>>> test_surf.fill(test_rgba, test_rect, pygame.BLEND_RGBA_MULT)
>>> ================================ RESTART ================================
>>>
This restart occurs regardless of how I interact, or do not interact, with the software. It occurs whether I call pygame.init()
after import pygame
or not.
If a rect argument entirely within the surface's bounds (in this case, (0,0,50,50)
) is used, it functions normally. Alternatively, omitting or sending 0
for the special_flags
argument does not trigger this problem; pixels contained by the Surface are altered as normal and any that 'spill' off the edge are ignored.
What I would like to know is what causes pygame to crash in this mysterious and unexplained way?
I'm using pygame 1.9.1 and python 2.7.10.