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

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



Brian Fisher wrote:
so the idea is to do something more like this:
   self.pixels = pygame.PixelArray( self.screen )  # locks screen
   draw()
   del self.pixels  # automatically unlocks screen

I don't think it's a good idea to rely entirely on reference
counting for releasing the lock, as it's easy to inadvertently
have extra references to an object around that are hard to
track down.

The pixel array should have some kind of explicit close()
method that you can call to make sure the lock is released
(and subsequent operations on it should raise an exception).

--
Greg