|
From: Mark B. <mb...@0x...> - 2000-07-14 15:48:30
|
On Fri, 14 Jul 2000, David Clark wrote: > While revising my documentation, I notice the following items: > 1) The following code produces a segfault under 0.0.7 (and maybe earlier > versions: There's a race condition in the Surface object's destructor. SDL uses global variables for its 'display' management. This is one of the reasons you'll not see SDL providing access to multiple displays at once anytime in the near future. But more on point is the fact that when you call SDL_FreeSurface on the 'display,' the function checks whether it's the display surface or not. If it is, it returns without freeing the surface. What ends up happening is PySDL calls SDL_FreeSurface on a already freed 'display' surface. To remedy this, I've added a second pseudo-class called "MSurface." Its destructor doesn't attempt to free the surface when called, so this sort of thing is impossible. For all other purposes, 'MSurface' is the same as 'Surface,' so it shouldn't be considered different than a Surface. I've also fixed a memory leak in video_set_mode, pertaining to reinitializing the TTF library. > 2) I noticed there's no way to pass the fill_rect() function a NULL > rect like there is in SDL_FillRect() or update_rect(). Could we have > surface.fill_rect((0,0,0,0), somecolor) fill the surface with color? I've actually been thinking about making (0, 0, 0, 0) the default for update_rect(), so people wouldn't need to provide the tuple. 'fill_rect' is a bit of a problem, in that it's not as easy to apply the default argument to it. Perhaps a better calling convention would have been (color, rect), but it's a bit late to change it now. Perhaps a 'fill' method is in order, which takes just a color and fills the entire surface? |