[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] BUG: segfault when blitting surface to itself



On Fri, Apr 11, 2008 at 8:33 PM, Marcus von Appen <mva@xxxxxxxxxxxx> wrote:
On, Fri Apr 11, 2008, Hugo Arts wrote:

> python version: 2.5.1
> pygame version: 1.8
> OS: Windows XP
>
> If you attempt to blit a surface to itself, python segfaults. Seems to occur
> only on windows (tested on XP and Ubuntu).
> I understand there is no reason to do this, but it would seem more
> appropriate to throw an exception or something like that.
>
> script to reproduce:
> import pygame
> pygame.init()
>
> a = pygame.Surface((10, 10))
> a.blit(a, (0, 0))

Is there some case where blitting a surface on itself might be desired
or necessary? If not, I'll add a simple check that tests the passed
surface on equality and let blit() throw an exception, if both are the
same.

Regards
Marcus

I can't think of a reason to blit a sprite onto itself. And if you really want to,
you could create a copy of the surface, and blit with that (though it would be less memory efficient).

Hugo