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

Re: [pygame] no unlock: surfarray.pixels2d() and PixelArray() bug or intented?



On, Sat Jun 07, 2008, Jake b wrote:

[...]
> I was able to get it working by manually unlocking. It just seemed weird design:
> 
> # (1) before needing pixels
> init()
>     # ...
> draw()
>     self.screen.blit ( image, dest_rect )
> 
> # (2) adding pixel refs; breaks blit down the line
> init()
>     self.pixels = pygame.PixelArray( self.screen )
> draw()
>     self.screen.blit ( image, dest_rect )
> 
> # (3) which does an exception, but you can fix it:
> init()
>     self.pixels = pygame.PixelArray( self.screen )
>     self.screen.unlock()

After this manual unlock, the PixelArray is unlikely to work in any
case. You might expect weird behaviour in some cases, random
segmentation faults and other crashes on trying to access self.pixels
after the unlock. See my other mail about the why and how to avoid such
things.

Regards
Marcus

Attachment: pgpgQcZyH9aO2.pgp
Description: PGP signature